问题
when I run tomcat and the war is deployed I get : NoClassDefFoundError : org/apache/commons/collections/map/LRUMap
Invocation of init method failed; nested exception is
java.lang.NoClassDefFoundError:
org/apache/commons/collections/map/LRUMap
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
~[spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
What is strange is that I got the commons-collections-2.1.jar
(I even tried 3.1) in my WEB-INF lib folder.
Edit :
I did copy the commons-collections
from WEB-INF/lib
to Tomcat lib
and it seems to work. However I won't be able to do that on the production server, why isn't it taking my WEB-INF/lib
version ?
回答1:
Ok so I did put version 3.2.1 of commons-collections and the error disappeared. I unfortunately still don't know which library is depending on this version. Even mvn dependency:tree
didn't help ...
回答2:
I had this exception when I was with xdoclet
on dependencies.
If you are with this dependency, just exclude it.
回答3:
I have the same probleme, maybe it's too late to approve the answer but it's still benefitial for people who will have this problem in the futur. So I exclude commons-collections from net.sf.jasperreports, after that the tomcat runs perfectly whithout any problem.
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.1.1</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
</exclusions>
</dependency>
来源:https://stackoverflow.com/questions/13045262/spring-hibernate-tomcat-dependency-problems