当我尝试运行我的java控制台应用程序时,我在Red Hat 5上看到以下错误,但在Ubuntu上没有。
另一个StackOverflow post提到不要混合spring 2和3的版本。
但是我运行了find [where I run app - includes classpath] | grep spring | grep 3并看到了0的结果。因此,我认为这不是spring版本的问题。
> Exception in thread "main"
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Failed to import bean definitions from URL
> location
> [classpath:/org/eurekastreams/server/conf/applicationContext-model.xml]
> Offending resource: class path resource [conf/applicationContext.xml];
> nested exception is
> org.springframework.beans.factory.BeanDefinitionStoreException:
> Unexpected exception parsing XML document from class path resource
> [org/eurekastreams/server/conf/applicationContext-model.xml]; nested
> exception is java.lang.NoSuchMethodError:org.springframework.aop.config.
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary
(Lorg/springframework/beans/factory/xml/ParserContext;
Lorg/w3c/dom/Element;)V编辑
添加堆栈跟踪:
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V
运行mvn dependency:tree之后,我看到了几个版本的spring-aop.jar
$grep "spring-aop" mvn_dependency_tree.txt
[INFO] | +- org.springframework:spring-aop:jar:2.0.8:compile
[INFO] | | | +- org.springframework:spring-aop:jar:2.0.8:provided
[INFO] | | +- org.springframework:spring-aop:jar:2.0.8:compile
[INFO] | | +- org.springframework:spring-aop:jar:2.5.4:compile这些不同版本的spring-aop可能会解释我添加的堆栈跟踪中的AOP错误吗?
发布于 2013-05-30 20:17:11
看起来,spring的2.0.8版本就是罪魁祸首。
您需要做的是检查依赖树输出(而不是grep输出),以找出哪个“父”jars对此版本有依赖,从而将它拖到类路径上。通过移除或升级父jars的版本,您应该能够清理类路径,留下2.5.4版本。
完成此操作后,重新构建并运行应用程序。
下面是有关依赖树的更多信息:
http://maven.apache.org/plugins/maven-dependency-plugin/index.html
http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
https://stackoverflow.com/questions/16843112
复制相似问题