Reputation: 41909
When I try to run my java
console app, I see the following errors on Red Hat 5
, but not on Ubuntu
.
Another StackOverflow post mentions not to mix versions of spring
2 and 3.
But I ran find [where I run app - includes classpath] | grep spring | grep 3
and saw 0 results. As a result, I believe it's not a spring
version issue.
> 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
EDIT
Added stack trace:
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V
After running mvn dependency:tree
, I saw a few versions of 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
Would these different versions of spring-aop
maybe explain the AOP
error from the stack trace I added?
Upvotes: 2
Views: 1441
Reputation: 7894
It looks like version 2.0.8 of spring-aop is the culprit here.
What you need to do is examine the dependency tree output (not grep it) to find out which 'parent' jars have a dependency on this version and hence are pulling it onto your classpath. Either by removing or upgrading the version of the parent jars, you should be able to clean the classpath, leaving behind version 2.5.4.
Once you have done this, rebuild and run your application.
Here is more info on dependency tree:
http://maven.apache.org/plugins/maven-dependency-plugin/index.html
Upvotes: 1