冲突带来的错误信息:
org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter struts2 java.lang.IncompatibleClassChangeError: class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.springframework.asm.ClassVisitor as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:112) at org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:85) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1045) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowire(AbstractAutowireCapableBeanFactory.java:344) at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:179) at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154) at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151) at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:192) at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:1110) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStack(XmlConfigurationProvider.java:928) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStacks(XmlConfigurationProvider.java:941) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptors(XmlConfigurationProvider.java:964) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:533) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:250) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5312) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722)
问题切入点:
class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.springframework.asm.ClassVisitor as super class
spring maven仓库上显示,spring-asm这个版本最高是3.1.4,其他一部分是3.2.4。而且spring2.5以后已经把asm单独封包成spring-asm,也就是说可以用spring-x-最高版本.jar与spring-asm-最高版本.jar来配合使用,但是问题就出现在这里。
但是如果你pom.xml里面你把spring-asm-3.1.4和spring-core-3.2.4同时引进去的话(注意:一定要注意顺序,是spring-asm-3.1.4在前,spring-core-3.2.4在后,这会引起包冲突)
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-asm</artifactId> <version>3.1.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.4.RELEASE</version> </dependency>
原因为:
spring-asm-3.1.4里的ClassVisitor是abstract interface
public abstract interface org.springframework.asm.ClassVisitor
spring-core-3.2.4里的ClassVisitor是abstract class
public abstract class org.springframework.asm.ClassVisitor
spring-core-3.2.4里的这句代码:
private static class ParameterNameDiscoveringVisitor extends ClassVisitor
明显ClassVisitor是 abstract class ,所以造成了冲突。
解决办法:
1、在pom.xml中去掉spring-asm-3.1.4的引用,因为spring-core-3.2.4已经把asm这个代码重新打包进去了
spring-core-3.2.4 包截图:
2、如果必须要用spring-asm-3.1.4的话,就在pom文件中,把spring-core-3.2.4的引用放在spring-asm-3.1.4之前(利用类加载顺序,但不建议这么做,会带来一些问题)。
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-asm</artifactId> <version>3.1.4.RELEASE</version> </dependency>
相关推荐
spring-core-3.2.4.RELEASE.jar spring-beans-3.2.4.RELEASE.jar spring-test-3.2.4.RELEASE.jar spring-web-3.2.4.RELEASE.jar spring-aop-3.2.4.RELEASE.jar spring-webmvc-3.2.4.RELEASE.jar spring-jdbc-3.2.4....
spring-core-3.2.4.RELEASE spring-expression-3.2.4.RELEASE spring-instrument-3.2.4.RELEASE spring-instrument-tomcat-3.2.4.RELEASE spring-jdbc-3.2.4.RELEASE spring-jms-3.2.4.RELEASE spring-orm-3.2.4....
在深入理解`spring-cglib-repack-3.2.4.jar`和`spring-objenesis-repack-2.5.1.jar`这两个jar包之前,我们先来了解一下Spring框架的核心概念。 Spring框架的核心包括依赖注入(Dependency Injection,DI)和面向切...
赠送jar包:cglib-nodep-3.2.4.jar; 赠送原API文档:cglib-nodep-3.2.4-javadoc.jar; 赠送源代码:cglib-nodep-3.2.4-sources.jar; 赠送Maven依赖信息文件:cglib-nodep-3.2.4.pom; 包含翻译后的API文档:cglib-...
spring-orm-3.2.4.RELEASE.jar,ssh整合的时候用的上。
然而,有时候在导入Spring项目时,可能会遇到一些问题,例如标题中提到的"spring-cglib-repack-3.2.4.jar"和"spring-objenesis-repack-2.4.jar"这两个jar包的缺失。这些jar包对于Spring框架的正常运行至关重要,因为...
支持springmvc框架,版本为3.2.4,Java技术开发使用
- **模块结构**:Spring Framework 3.2.4的源码分为多个模块,如core、context、beans、web等,每个模块负责特定的功能,便于代码组织和复用。 - **IoC容器**:深入研究`org.springframework.beans`和`org.spring...
spring-framework.zip,弹簧结构弹簧框架
spring-core-3.2.4.RELEASE.jar spring-expression-3.2.4.RELEASE.jar spring-instrument-3.2.4.RELEASE.jar spring-instrument-tomcat-3.2.4.RELEASE.jar spring-jdbc-3.2.4.RELEASE.jar spring-jms-3.2.4.RELEASE....
总的来说,"spring-cglib-repack-3.2.4.jar"和"spring-objenesis-repack-2.4.jar"是Spring框架核心功能的关键组成部分,它们与Spring的AOP代理、对象实例化以及依赖注入等核心特性密切相关。在进行Spring源码分析时...
不同的Spring版本可能依赖于不同版本的CGLIB和Objenesis,因此,选择与当前Spring版本相匹配的JAR包是非常重要的,以避免潜在的版本冲突和运行时异常。 总结,"spring-cglib-repack-3.2.4.jar"和"spring-objenesis-...
在给定的文件中,我们关注的是两个特定的库:`spring-objenesis-repack-2.4.jar` 和 `spring-cglib-repack-3.2.4.jar`,它们是Spring框架的扩展和补充。 `spring-objenesis-repack-2.4.jar` 包含了Objenesis库的一...
赠送jar包:cglib-nodep-3.2.4.jar; 赠送原API文档:cglib-nodep-3.2.4-javadoc.jar; 赠送源代码:cglib-nodep-3.2.4-sources.jar; 赠送Maven依赖信息文件:cglib-nodep-3.2.4.pom; 包含翻译后的API文档:cglib-...
spring-core-3.2.4.RELEASE.jar spring-expression-3.2.4.RELEASE.jar spring-jms-3.2.4.RELEASE.jar commons-logging.jar log4j-1.2.14.jar spring-context-support-3.2.4.RELEASE.jar spring-context-3.2.4....
"spring-objenesis-repack-2.5.1.jar" 是Objenesis库的特定版本,同样经过了与Spring框架的集成和优化。 **3. Jar包的生成方式** 描述中提到的"jar包的生成方式文档"是关键资源,它提供了如何根据Spring源码构建...
在Spring Framework 3.2.4.RELEASE中,开发者可以找到各种jar包,这些包包括了Spring的核心模块,如Core Container、Data Access/Integration、Web等,以及对其他技术如JDBC、JMS、WebSocket等的支持。源代码的提供...
《Spring框架3.2.4.RELEASE:理解与探索》 Spring Framework,作为Java领域最为广泛应用的开源框架之一,以其强大的功能和灵活的设计理念深受开发者喜爱。本文将围绕"spring-framework-3.2.4.RELEASE-dist.jar"包...
spring-jms-3.2.4.RELEASE.jar
spring源码深度分析源码依赖,将cglib和objenesis重新打包处理。同时添加grandle依赖:compile fileTree(dir: 'libs', include: ['*.jar'])