<legend id='8FR4g'><style id='8FR4g'><dir id='8FR4g'><q id='8FR4g'></q></dir></style></legend>

        <bdo id='8FR4g'></bdo><ul id='8FR4g'></ul>
      <i id='8FR4g'><tr id='8FR4g'><dt id='8FR4g'><q id='8FR4g'><span id='8FR4g'><b id='8FR4g'><form id='8FR4g'><ins id='8FR4g'></ins><ul id='8FR4g'></ul><sub id='8FR4g'></sub></form><legend id='8FR4g'></legend><bdo id='8FR4g'><pre id='8FR4g'><center id='8FR4g'></center></pre></bdo></b><th id='8FR4g'></th></span></q></dt></tr></i><div id='8FR4g'><tfoot id='8FR4g'></tfoot><dl id='8FR4g'><fieldset id='8FR4g'></fieldset></dl></div>

      <small id='8FR4g'></small><noframes id='8FR4g'>

      1. <tfoot id='8FR4g'></tfoot>

        xwork 和 xwork-core 中的冲突

        时间:2023-10-14

              <tbody id='VWrUK'></tbody>
              <bdo id='VWrUK'></bdo><ul id='VWrUK'></ul>

                <small id='VWrUK'></small><noframes id='VWrUK'>

              1. <i id='VWrUK'><tr id='VWrUK'><dt id='VWrUK'><q id='VWrUK'><span id='VWrUK'><b id='VWrUK'><form id='VWrUK'><ins id='VWrUK'></ins><ul id='VWrUK'></ul><sub id='VWrUK'></sub></form><legend id='VWrUK'></legend><bdo id='VWrUK'><pre id='VWrUK'><center id='VWrUK'></center></pre></bdo></b><th id='VWrUK'></th></span></q></dt></tr></i><div id='VWrUK'><tfoot id='VWrUK'></tfoot><dl id='VWrUK'><fieldset id='VWrUK'></fieldset></dl></div>
                <tfoot id='VWrUK'></tfoot>
                1. <legend id='VWrUK'><style id='VWrUK'><dir id='VWrUK'><q id='VWrUK'></q></dir></style></legend>
                  本文介绍了xwork 和 xwork-core 中的冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在尝试将 Struts 2 与零配置、Spring、Hibernate 和 Maven 集成.

                  I have been trying to integrate Struts 2 with Zero Configuration, Spring, Hibernate and Maven.

                  但是,我认为在集成中肯定有一些我缺少的东西,它必须与Maven的Pom.xml的配置有关:

                  But, what I think there must be something which I am missing in integration and it must be related to the configuration of Maven's Pom.xml:

                  <dependency>
                      <groupId>org.apache.struts</groupId>
                      <artifactId>struts2-core</artifactId>
                      <version>2.1.8.1</version>
                  </dependency>
                  
                  <!-- Struts 2 + Spring plugins -->
                  <dependency>
                      <groupId>org.apache.struts</groupId>
                      <artifactId>struts2-spring-plugin</artifactId>
                      <version>2.1.8.1</version>
                  </dependency>
                  
                  <!-- MySQL database driver -->
                  <dependency>
                      <groupId>mysql</groupId>
                      <artifactId>mysql-connector-java</artifactId>
                      <version>5.1.9</version>
                  </dependency>
                  
                  <!-- Spring framework --> 
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring</artifactId>
                      <version>2.5.6</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-web</artifactId>
                      <version>2.5.6</version>
                  </dependency>
                  
                  <!-- Hibernate core -->
                  <dependency>
                      <groupId>asm</groupId>
                      <artifactId>asm-all</artifactId>
                      <version>3.3</version>
                  </dependency>
                  <dependency>
                      <groupId>asm</groupId>
                      <artifactId>asm</artifactId>
                      <version>3.3</version>
                  </dependency>
                      <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-core</artifactId>
                      <version>3.6.7.Final</version>
                  </dependency>
                  
                  <!-- Hibernate core library dependency start -->
                  
                  <!-- Hibernate core library dependency end -->
                  
                  <!-- Hibernate query library dependency start -->
                  <dependency>
                      <groupId>org.apache.struts</groupId>
                      <artifactId>struts2-convention-plugin</artifactId>
                      <version>2.1.8.1</version>
                  </dependency>
                  <dependency>
                      <groupId>javax.servlet</groupId>
                      <artifactId>javax.servlet-api</artifactId>
                      <version>3.0.1</version>
                      <scope>provided</scope>
                  </dependency>
                  <dependency>
                      <groupId>log4j</groupId>
                      <artifactId>log4j</artifactId>
                      <version>1.2.15</version>
                  </dependency>
                  

                  当我使用这个配置时,它给了我一个错误

                  As when I use this configuration it gives me an error

                  java.lang.NoSuchMethodError: com.opensymphony.xwork2.util.finder.UrlSet.<init>(Lcom/opensymphony/xwork2/util/finder/ClassLoaderInterface;Ljava/util/Set;)V
                  

                  我使用依赖关系而不是 opensymphony XWork libaray

                  And instead of opensymphony XWork libaray I use dependency of

                  <dependency>
                      <groupId>org.apache.struts.xwork</groupId>
                      <artifactId>xwork-core</artifactId>
                      <version>2.3.8</version>
                  </dependency> 
                  

                  它抛出了这个异常

                  Caused by: Unable to load configuration. - [unknown location]
                      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
                  

                  推荐答案

                  当你升级Struts2的版本时,你必须将你的应用程序需要的库更新到目标版本.Struts2 的每个发行版都在 lib 文件夹中提供了与发行版版本兼容的相应库集.如果您使用 maven 来解析和获取依赖项,您应该考虑工件 struts2-core.

                  When you upgrade the version of Struts2, you have to update the libraries requires by your application to the target version. Each distro of Struts2 supplied with the corresponding set of libraries in the lib folder that are compatible with the version of distro. If you use maven to resolve and fetch the dependencies you should consider the artifact struts2-core.

                  <dependency>
                      <groupId>org.apache.struts</groupId>
                      <artifactId>struts2-core</artifactId>
                      <version>2.3.8</version>
                  </dependency>
                  


                  它将获取此工件所需的所有依赖项,其他依赖项,例如您需要单独添加的插件.使用针对插件的相同版本.例如添加约定插件使用


                  It will fetch all required dependencies for this artifact, other dependencies, such as plugins you need to add separately. Use the same version targeted to plugins. For example to add a convention plugin use

                  <dependency>
                      <groupId>org.apache.struts</groupId>
                      <artifactId>struts2-convention-plugin</artifactId>
                      <version>2.3.8</version>
                  </dependency>
                  


                  我选择了 2.3.8 的目标版本号,但它可能与其他功能不兼容,即 Hibernate 和 Spring,哪些版本需要通过将相应的工件添加到依赖项来单独升级.


                  The targeted version number I've chosen 2.3.8 but it's possibly incompatible with the other features i.e. Hibernate and Spring which versions need to upgrade separately by adding corresponding artifacts to the dependencies.

                  最后也是最耗时的是更改项目的源代码,根据较新的 DTD 更新配置文件,API 更改,修复弃用.为此,请考虑阅读 发行说明.

                  And finally and most time consuming is changes to the source code of the project, update the configuration files according to newer DTDs , API changes, fix deprecations. For this purpose consider reading the release notes.

                  另见开发Maven项目的例子:使用 Maven 创建 Struts 2 Web 应用程序来管理工件和构建应用程序.

                  Also see the example of developing a Maven project: Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application.

                  这篇关于xwork 和 xwork-core 中的冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Freemarker 和 Struts 2,有时它评估为一个序列+扩展哈希 下一篇:休眠 - 回滚:org.hibernate.MappingException:未知实体

                  相关文章

                    <bdo id='0IKJO'></bdo><ul id='0IKJO'></ul>

                  <i id='0IKJO'><tr id='0IKJO'><dt id='0IKJO'><q id='0IKJO'><span id='0IKJO'><b id='0IKJO'><form id='0IKJO'><ins id='0IKJO'></ins><ul id='0IKJO'></ul><sub id='0IKJO'></sub></form><legend id='0IKJO'></legend><bdo id='0IKJO'><pre id='0IKJO'><center id='0IKJO'></center></pre></bdo></b><th id='0IKJO'></th></span></q></dt></tr></i><div id='0IKJO'><tfoot id='0IKJO'></tfoot><dl id='0IKJO'><fieldset id='0IKJO'></fieldset></dl></div>

                      <tfoot id='0IKJO'></tfoot>
                    1. <legend id='0IKJO'><style id='0IKJO'><dir id='0IKJO'><q id='0IKJO'></q></dir></style></legend>

                      <small id='0IKJO'></small><noframes id='0IKJO'>