title: Tomcat/IntelliJ run fails
body: <p>Using Intellij and Tomcat7, I am trying to run my the <code>war exploded</code> application,but I am encountering errors.</p>
  
  <p>The same application compiled using ANT (outside of Intelij) works fine, with no errors..</p>
  
  <p>It fails with the following log:</p>
  
  <pre><code>"C:\Program Files\Java\jdk1.7.0_07\bin\java" -Dcatalina.base=C:\Users\myname\.IntelliJIdea11\system\tomcat\Unnamed_my_portal_2 "-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 7.0" "-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp" -cp "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\tomcat-juli.jar" org.apache.catalina.startup.Bootstrap start
  Dec 11, 2012 6:27:07 PM org.apache.catalina.core.AprLifecycleListener init
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_07\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.1.3\bin\..\.\bin;C:\Program Files (x86)\IBM\RationalSDLC\common;C:\Program Files (x86)\IBM\RationalSDLC\Clearquest\cqcli\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\mycompany\Endpoint Security Agent\Endpoint Common\bin;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\mycompany\Endpoint Security\Endpoint Common\bin;x:\Bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\CVSNT\;c:\program files (x86)\jetbrains\intellij idea 11.1.3\jre\jre\bin;.
  Dec 11, 2012 6:27:08 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8080"]
  Dec 11, 2012 6:27:08 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  Dec 11, 2012 6:27:08 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 1018 ms
  Dec 11, 2012 6:27:08 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Dec 11, 2012 6:27:08 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
  Dec 11, 2012 6:27:08 PM org.apache.catalina.startup.HostConfig deployDescriptor
  INFO: Deploying configuration descriptor C:\Users\myname\.IntelliJIdea11\system\tomcat\Unnamed_my_portal_2\conf\Catalina\localhost\ROOT.xml
  Dec 11, 2012 6:27:10 PM org.apache.catalina.core.ContainerBase addChildInternal
  SEVERE: ContainerBase.addChild: start: 
  org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
      at java.lang.Class.getDeclaredFields0(Native Method)
      at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
      at java.lang.Class.getDeclaredFields(Class.java:1760)
      at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87)
      at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
      at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 11 more
  Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      ... 25 more
  
  Dec 11, 2012 6:27:10 PM org.apache.catalina.startup.HostConfig deployDescriptor
  SEVERE: Error deploying configuration descriptor C:\Users\myname\.IntelliJIdea11\system\tomcat\Unnamed_my_portal_2\conf\Catalina\localhost\ROOT.xml
  java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  
  Dec 11, 2012 6:27:10 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8080"]
  Dec 11, 2012 6:27:10 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  Dec 11, 2012 6:27:10 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 1930 ms
  Connected to server
  </code></pre>
  
  <p>What have I done wrong? What do I need to do to fix this? and what can I do to prevent this in the future?</p>