title: Run Spring 3.1 webapp on tomcat 7 / maven embedded tomcat
body: <p>I'm just upgrading from Spring 3.0.6 to 3.1 and there seems to be an issue with running it on a Tomcat. Appearently it has a Spring 3.0.6 dependency and will try to use it when started. That however conflicts with my Spring 3.1 app. I get this when trying to deploy via</p>
  
  <pre><code>mvn clean package tomcat:run
  </code></pre>
  
  <p>as well as when trying to run it in a Tomcat 7 (via Eclipse or by just copying it to the tomcat webapps folder)</p>
  
  <p>What's the solution here? Might upgrading to Maven 3 help? What about the maven Tomcat-plugin? 1.1 is released so far but version 2 seems to be still under development. Does anyone have a pom setup that uses a 2.x version of the tomcat plugin?</p>
  
  <p>(My current error log basicly says this:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/springframework/core/annotation/AnnotationAttributes
  </code></pre>
  
  <p>which appearently is a version conflict between Spring 3.1 and 3.0.x)</p>
  
  <p>I'm quite lost on this one, been trying all day to work my way through the dependency mess in my modules to upgrade them to 3.1, all the tests run and now I can't run it on Tomcat.. :(</p>
  
  <hr>
  
  <p><strong>edit: my spring dependency tree:</strong></p>
  
  <pre><code> module1:jar:1.0-SNAPSHOT:compile
   +- modul2:jar:1.0-SNAPSHOT:compile
   |  +- module3:jar:1.1-SNAPSHOT:compile
   |  |  +- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
   |  |  +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
   |  |  +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
   |  |  +- org.springframework:spring-aspects:jar:3.1.0.RELEASE:compile
   |  |  +- org.springframework:spring-orm:jar:3.1.0.RELEASE:compile
   |  |  |  +- org.springframework:spring-jdbc:jar:3.1.0.RELEASE:compile
   |  |  |  \- org.springframework:spring-tx:jar:3.1.0.RELEASE:compile
   |  |  \- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
   |  +- org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
   |  |  +- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
   |  |  +- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
   |  |  +- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
   |  |  \- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
   |  \- org.springframework:spring-test:jar:3.1.0.RELEASE:compile
   \- org.springframework:spring-test-mvc:jar:1.0.0.BUILD-SNAPSHOT:test
  </code></pre>
  
  <hr>
  
  <p><strong>edit 2:</strong></p>
  
  <p>For some curious reason, when I delete all Spring 3.0.6 libs from my .m2 folder and then package the webapp, it will download all the 3.0.6 jars again. The dependency tree however is the one above. I assume it has to do with spring-security which has some issue with the version and requires me to override the transient dependencies in my security module pom so it won't use the older ones...</p>
  
  <hr>
  
  <p><strong>edit 3:</strong></p>
  
  <p>It's <strong>spring-data-jpa</strong>. Appearently the latest version still depends on Spring 3.0.6. I can get it to play along with Spring 3.1 by overriding the dependencies in the pom, so the tests run through. When integrating my data module into my webapp however it will try to use Spring 3.0.6... No idea how to get around that problem. Even the latest Realase Candidate for <a href="http://repo.springsource.org/libs-milestone/org/springframework/data/spring-data-jpa/1.1.0.RC1/" rel="nofollow">spring-data-jpa (version 1.1.0.RC1)</a> still depends on Spring 3.0.7...</p>