title: Tomcat failing to deploy my servlet on Tomcat within Eclipse (NoClassDefFoundError)
body: <p>I have a Hello Wolrd Servlet in a Maven project created with Java EE Eclipse (Juno). The pom.xml specifies the following dependancies:</p>
  
  <ul>
  <li>junit</li>
  <li>tomcat-servlet-api</li>
  </ul>
  
  <p>"Run As > Maven install" seems to run fine and outputs a .war file in /target/.</p>
  
  <p>This .war deploys (Apache app manager) and runs fine on an other machine using tomcat 7.0.26-1ubuntu1.2 (installed via apt-get).</p>
  
  <p>I configured Eclipse (using the server view) to use an apache-tomcat-7.0.40 install that I extracted from a tar.gz archive. It also runs fine using "Run As > Run on Server".</p>
  
  <p>Now, if I add this to the Hello World servlet:</p>
  
  <pre><code>PropertiesConfiguration config = new
  PropertiesConfiguration("config.properties");
  </code></pre>
  
  <p>and</p>
  
  <pre><code>import org.apache.commons.configuration.ConfigurationException;
  import org.apache.commons.configuration.PropertiesConfiguration;
  </code></pre>
  
  <p>and add the following dependency to my pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;commons-configuration&lt;/groupId&gt;
      &lt;artifactId&gt;commons-configuration&lt;/artifactId&gt;
      &lt;version&gt;1.9&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>It keeps running fine on the distant server, but when using "Run As > Run on Server" in Eclipse, it fails, which is not cool for efficient dev &amp; debug:</p>
  
  <pre><code>May 30, 2013 6:42:28 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: /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
  May 30, 2013 6:42:28 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:proxy' did not find a matching property.
  May 30, 2013 6:42:28 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8080"]
  May 30, 2013 6:42:28 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-5443"]
  May 30, 2013 6:42:28 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  May 30, 2013 6:42:28 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 561 ms
  May 30, 2013 6:42:28 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  May 30, 2013 6:42:28 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
  May 30, 2013 6:42:28 PM org.apache.catalina.core.ContainerBase startInternal
  SEVERE: A child container failed during start
  java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/proxy]]
      at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
      at java.util.concurrent.FutureTask.get(FutureTask.java:111)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      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:1146)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:679)
  Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/proxy]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      ... 7 more
  Caused by: java.lang.NoClassDefFoundError: org/apache/commons/configuration/ConfigurationException
      at java.lang.Class.getDeclaredFields0(Native Method)
      at java.lang.Class.privateGetDeclaredFields(Class.java:2318)
      at java.lang.Class.getDeclaredFields(Class.java:1762)
      at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
      at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
      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:5269)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.ConfigurationException
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      ... 21 more
  May 30, 2013 6:42:28 PM org.apache.catalina.core.ContainerBase startInternal
  SEVERE: A child container failed during start
  java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
      at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
      at java.util.concurrent.FutureTask.get(FutureTask.java:111)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
  Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      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:1146)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:679)
  Caused by: org.apache.catalina.LifecycleException: A child container failed during start
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
  May 30, 2013 6:42:28 PM org.apache.catalina.startup.Catalina start
  SEVERE: Catalina.start: 
  org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
  Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
  Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 9 more
  Caused by: org.apache.catalina.LifecycleException: A child container failed during start
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 11 more
  May 30, 2013 6:42:28 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 239 ms
  </code></pre>
  
  <p>Reading a bunch of posts, I found a way to make it work doing "Properties > Deployment Assembly > Add > Java Build Path Entries > Maven Dependencies", but Maven resets this setting on a "Maven > Update Project".</p>
  
  <p>Is it possible to define an appropriate setting within the pom.xml to avoid this issue ?</p>
  
  <p>Extra info: I'm using maven-compiler-plugin and maven-war-plugin. (may be the wrong way!)</p>