![](/img/trans.png)
[英]java.lang.NoSuchMethodError when running SoapUIMockServiceRunner
[英]NoSuchMethodError when Running Java App
當我嘗試運行java
控制台應用程序時,在Red Hat 5
上看到以下錯誤,但是在Ubuntu
上卻沒有。
另一個StackOverflow 帖子提到不要混合使用spring
2和spring
3。
但是我find [where I run app - includes classpath] | grep spring | grep 3
我在find [where I run app - includes classpath] | grep spring | grep 3
find [where I run app - includes classpath] | grep spring | grep 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
運行spring-aop.jar
: 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
錯誤?
看起來這里的罪魁禍首是spring-aop的2.0.8版本。
您需要做的是檢查依賴關系樹的輸出(而不是grep),以找出哪些“父”罐對此版本具有依賴關系,因此將其拉到類路徑中。 通過刪除或升級父jar的版本,您應該能夠清除類路徑,而保留版本2.5.4。
完成此操作后,重建並運行您的應用程序。
這是有關依賴樹的更多信息:
http://maven.apache.org/plugins/maven-dependency-plugin/index.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.