Read my previous blog to see why I got here…
Here are some other things I tripped over when moving the project to Spring 3.0
If your project gets the following exception ..
.. you are probably using Struts 1.1 and not including the struts dependency from Spring.
Include this in your maven dependencies and you should be good to go.
<dependency> <groupid>org.springframework</groupid> <artifactid>spring-struts</artifactid> <version>3.0.0.RELEASE</version> </dependency>
Struts 1.1 dependency was removed in Spring 3.0 but was reintroduced later in deprecated form. Read more about it here.
If your project get the following exception…
… you were using Spring 2.3 or lower according to this entry.
Use ContextLoaderListener instead of ContextLoaderServlet.
Remove the servlet entry from your web.xml for ContextLoaderServlet and add the following listener…
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
I was recently moving our project from Spring 2.5.6 to Spring 3.0 when I encountered a ClassNotFoundException. The jar containing the class was present in the war and everything pointed to a jar conflict.
I tried to search in Eclipse but could not find any reference to any other version of Spring. The following command made my life easy …
mvn dependency:tree -Dverbose
Details can be found here .
It gave me a list of the dependencies in a nice tree format and the culprit was found. It was Spring 2.0.7 jar that was being loaded from a module that I had not imported in Eclipse.
[INFO] | | +- com.ostermiller:ostermillerutils:jar:20041102:compile [INFO] | | +- (log4j:log4j:jar:1.2.13:compile - omitted for duplicate) [INFO] | | +- (commons-collections:commons-collections:jar:3.2:compile - omitted for duplicate) [INFO] | | +- <strong>org.springframework:spring:jar:2.0.7:compile</strong> [INFO] | | | \- (commons-logging:commons-logging:jar:1.1:compile - omitted for conflict with 1.0.4) [INFO] | | +- (org.hibernate:hibernate:jar:3.2.1.ga:compile - omitted for conflict with 3.2.6.ga) [INFO] | | \- net.sourceforge.jtds:jtds:jar:1.2:runtime [INFO] | +- (log4j:log4j:jar:1.2.13:compile - omitted for duplicate)
Hope this helps someone who runs into a similar problem.