调试java.lang.IncompatibleClassChangeError:实现类错误(Spring/Hibern



我最近开始尝试升级Struts2/Spring/HHibernate应用程序的一些依赖项,这些依赖项已经过时好几年了,主要是为了获取@Enumerated注释。POM一路上变得越来越干净,这是一个很好的副作用

所有的代码都编译了,单元测试都通过了,但服务器不会从开始

"原因:java.lang.IncompatibleClassChangeError:实现类"

错误消息。

我关注了几个关于追踪依赖关系中版本不匹配的线程——人们似乎经常得到两个版本的hibernate。我想我没有这个问题:

[INFO] [snip MyProjectName]
[INFO] - org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
[INFO]    +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO]    - org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO]       - org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile

起初,我认为3.2.0最终引用是原因,但进一步的研究使其听起来像是一个空洞的占位符工件。

然而,我认为我的春季依赖性是问题所在,但我不确定该解决什么问题,或者我是否在考虑另一个转移注意力的问题:

[INFO] [snip MyProjectName]
[INFO] +- org.springframework:org.springframework.orm:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:org.springframework.jdbc:jar:3.1.1.RELEASE:compile
[INFO] |  - org.springframework:org.springframework.transaction:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.web:jar:3.1.1.RELEASE:compile
[INFO] |  - org.springframework:org.springframework.aop:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.beans:jar:3.1.1.RELEASE:compile
[INFO] |  - org.springframework:org.springframework.asm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.context:jar:3.1.1.RELEASE:compile
[INFO] |  - org.springframework:org.springframework.expression:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.core:jar:3.1.1.RELEASE:compile
[INFO] - org.apache.struts:struts2-spring-plugin:jar:2.2.3.1:compile
[INFO]    +- org.springframework:spring-beans:jar:2.5.6:compile
[INFO]    +- org.springframework:spring-core:jar:2.5.6:compile
[INFO]    +- org.springframework:spring-context:jar:2.5.6:compile
[INFO]    - org.springframework:spring-web:jar:2.5.6:compile

所以我认为我看到了两个可能的问题

  1. struts2spring插件正在引入旧版本的spring——然而,到目前为止,我发现的每一个网络资源都表明struts2spring插件应该与新版本的spring一起使用。我是不是做错了什么?我还没有找到其他更新版本的插件可以尝试。

  2. 为了找到spring的新版本,我不得不切换到ERB spring存储库,所以artifactId在两者之间不匹配——spring的直接依赖项是org.springframework:org.springfframework.{component},而间接依赖项是.org.springframework:spring-{component}。这是个问题吗?我试着在ERB spring存储库中寻找struts2 spring插件,但他们没有托管它,所以我怀疑我是否能找到与artifactId命名方案匹配的版本。

接下来,我将列出pom的完整依赖部分,以防以上两者都是危险的。我是否应该使用其他工具/调查来解决问题?非常感谢。

<dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.4</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.easymock</groupId>
    <artifactId>easymockclassextension</artifactId>
    <version>3.0</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>r07</version>
  </dependency>
  <dependency>
    <groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
    <version>1.4.1</version>
  </dependency>
  <dependency>
    <groupId>org.dbunit</groupId>
    <artifactId>dbunit</artifactId>
    <version>2.2</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.5.6-Final</version>
  </dependency>
  <dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.1-901.jdbc3</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.orm</artifactId>
    <version>3.1.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.web</artifactId>
    <version>3.1.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.beans</artifactId>
    <version>3.1.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.context</artifactId>
    <version>3.1.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.core</artifactId>
    <version>3.1.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.14</version>
  </dependency>
  <dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.1</version>
  </dependency>
  <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-spring-plugin</artifactId>
    <version>2.2.3.1</version>
  </dependency>
  <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.2.3.1</version>
  </dependency>
  <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-config-browser-plugin</artifactId>
    <version>2.2.3.1</version>
  </dependency>
  <dependency>
   <groupId>org.apache.struts</groupId>
   <artifactId>struts2-json-plugin</artifactId>
   <version>2.2.3.1</version>
 </dependency>
 <dependency>
    <groupId>com.jgeppert.struts2.jquery</groupId>
    <artifactId>struts2-jquery-plugin</artifactId>
    <version>2.4.1</version>
 </dependency>
 <dependency>
    <groupId>com.jgeppert.struts2.jquery</groupId>
    <artifactId>struts2-jquery-grid-plugin</artifactId>
    <version>2.4.1</version>
 </dependency>
 <dependency>
    <groupId>com.jgeppert.struts2.jquery</groupId>
    <artifactId>struts2-jquery-richtext-plugin</artifactId>
    <version>2.4.1</version>
 </dependency>
<dependency>
  <groupId>org.freemarker</groupId>
  <artifactId>freemarker</artifactId>
  <version>2.3.16</version>
 </dependency>
 <dependency>
  <groupId>org.apache.struts</groupId>
  <artifactId>struts2-sitemesh-plugin</artifactId>
  <version>2.2.1</version>
 </dependency>
 <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-convention-plugin</artifactId>
    <version>2.2.1</version>
 </dependency>    
 <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.4</version>
  <scope>provided</scope>
 </dependency>
 <dependency>
  <groupId>taglibs</groupId>
  <artifactId>standard</artifactId>
  <version>1.1.2</version>
 </dependency>
 <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>jstl</artifactId>
  <version>1.1.2</version>
 </dependency>
 <dependency>
  <groupId>concurrent</groupId>
  <artifactId>concurrent</artifactId>
  <version>1.3.4</version>
 </dependency>
 <dependency>
  <groupId>com.itextpdf</groupId>
  <artifactId>itextpdf</artifactId>
  <version>5.0.4</version>
 </dependency>
</dependencies>

如果您要使用与所需版本不同的版本,则需要从struts 2 spring插件中排除spring依赖项。

相关内容

  • 没有找到相关文章

最新更新