我最近开始尝试升级一些已经过时几年的 Struts2/Spring/Hibernate 应用程序的依赖项——主要是为了尝试使用 @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.Final 引用是原因,但进一步的研究使它听起来像它只是一个空的占位符工件,为了遗留问题。
但是,我认为我的 spring 依赖项是问题所在,但我不确定要修复什么,或者我是否正在查看另一个红鲱鱼:
[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
所以我想我看到了两个可能的问题
struts2-spring-plugin 正在引入旧版本的 spring——但是到目前为止我发现的每个 web 资源都说 struts2-spring-plugin 应该与新版本的 spring 一起工作。我在这里做错了吗?我还没有找到其他更新版本的插件可以尝试。
我不得不切换到 ERB spring 存储库才能找到新版本的 spring,所以 artifactIds 在两者之间不匹配——直接的 spring 依赖项是 org.springframework:org.springframe.{component} 而间接是 org.springframework:spring-{component}。这是一个问题吗?我尝试在 ERB spring 存储库中查找 struts2-spring-plugin,但他们没有托管它,所以我怀疑我能否找到与 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>