title: java.lang.NoClassDefFoundError: org/apache/catalina/LifecycleException
body: <p>I am working on a project which looks to embed tomcat in a java web application.
  I wish to convert this application into java web start so that it can be deployed and anyone who downloads the application can use the application on the embedded server without having to download tomcat.
  The problem I am facing is that the code runs perfectly when I run it on eclipse but when I convert it into a downloadable file which on starting shows the error I have mentioned in my title.
  I had an error previously which said... java.lang.NoClassDefFoundError: org/apache/catalina/Context 
  I fixed this by using the Catalina jar file as one of my resources href in the jnlp file.
  This LifecycleException though according to my knowledge is a part of Catalina.jar.
  Please do help in solving my error or at least point me in the right direction to solve it.
  I'm running the code using a maven project on Eclipse IDE.
  Thanks! </p>
  
  <pre><code>package com.N.VJ;
  
  import java.io.File;
  import javax.servlet.ServletException;
  import org.apache.catalina.LifecycleException;
  import org.apache.catalina.startup.Tomcat;
  
  public class App {
  
  public static void main(String[] args) throws LifecycleException, 
  InterruptedException, ServletException {
  
  String docBase = "src/main/webapp/";
  
  Tomcat tomcat = new Tomcat();
  String webPort = System.getenv("PORT");
      if(webPort == null || webPort.isEmpty()) {
          webPort = "8088";
      }
      tomcat.setPort(Integer.valueOf(webPort));
  
  tomcat.addWebapp("/", new File(docBase).getAbsolutePath());
  System.out.println("configuring app with basedir: " + new File("./" + 
  docBase).getAbsolutePath());
  
  tomcat.start();
  tomcat.getServer().await();
  }
  
  }
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.tom1&lt;/groupId&gt;
  &lt;artifactId&gt;cat1&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;cat1 Maven Webapp&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;dependencies&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;junit&lt;/groupId&gt;
    &lt;artifactId&gt;junit&lt;/artifactId&gt;
    &lt;version&gt;3.8.1&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
  &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
  &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
  &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
  &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
  &lt;artifactId&gt;tomcat-embed-logging-juli&lt;/artifactId&gt;
  &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;build&gt;
  &lt;finalName&gt;cat1&lt;/finalName&gt;
  
  &lt;plugins&gt;
  &lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
  &lt;configuration&gt;
      &lt;archive&gt;
          &lt;manifest&gt;
              &lt;mainClass&gt;com.tom1.cat1.App&lt;/mainClass&gt;
          &lt;/manifest&gt;
      &lt;/archive&gt;
  &lt;/configuration&gt;
  &lt;/plugin&gt;        
   &lt;plugin&gt;
    &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
    &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.0&lt;/version&gt;
    &lt;configuration&gt;
      &lt;port&gt;${tomcat.port}&lt;/port&gt;
      &lt;path&gt;/&lt;/path&gt;
    &lt;/configuration&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;tomcat-run&lt;/id&gt;
        &lt;goals&gt;
          &lt;goal&gt;exec-war-only&lt;/goal&gt;
        &lt;/goals&gt;
        &lt;phase&gt;package&lt;/phase&gt;
        &lt;configuration&gt;
          &lt;path&gt;/&lt;/path&gt;
          &lt;port&gt;${tomcat.port}&lt;/port&gt;
          &lt;attachArtifactClassifierType&gt;war&lt;/attachArtifactClassifierType&gt;
  
  &lt;mainClass&gt;org.apache.tomcat.maven.runner.Tomcat8RunnerCli&lt;/mainClass&gt;
          &lt;extraDependencies&gt;
            &lt;extraDependency&gt;
              &lt;groupId&gt;com.nitorcreations&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat8-war-runner&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
            &lt;/extraDependency&gt;
          &lt;/extraDependencies&gt;
        &lt;/configuration&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-util&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-coyote&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-api&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-dbcp&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-servlet-api&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-jsp-api&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-jasper&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-jasper-el&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-el-api&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-catalina&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-tribes&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-catalina-ha&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-annotations-api&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-juli&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-embed-logging-juli&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-embed-logging-log4j&lt;/artifactId&gt;
        &lt;version&gt;${tomcat.version}&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.2&lt;/version&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;id&gt;tomcat-run&lt;/id&gt;
          &lt;goals&gt;
            &lt;goal&gt;exec-war-only&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;phase&gt;package&lt;/phase&gt;
          &lt;configuration&gt;             
            &lt;warRunDependencies&gt;
              &lt;warRunDependency&gt;
                &lt;dependency&gt;
                  &lt;groupId&gt;com.tom1&lt;/groupId&gt;
                  &lt;artifactId&gt;cat1&lt;/artifactId&gt;
                  &lt;version&gt;4&lt;/version&gt;
                  &lt;type&gt;war&lt;/type&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
  &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
  &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
  &lt;version&gt;2.3-SNAPSHOT&lt;/version&gt;
  &lt;type&gt;maven-plugin&lt;/type&gt;
  &lt;/dependency&gt;
                &lt;contextPath&gt;/&lt;/contextPath&gt;
              &lt;/warRunDependency&gt;
            &lt;/warRunDependencies&gt;
            &lt;enableNaming&gt;true&lt;/enableNaming&gt;
            &lt;extraDependencies&gt;
              &lt;extraDependency&gt;
                &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
                &lt;artifactId&gt;derby&lt;/artifactId&gt;
                &lt;version&gt;10.1.3.1&lt;/version&gt;
              &lt;/extraDependency&gt;
              &lt;extraDependency&gt;
                &lt;groupId&gt;javax.mail&lt;/groupId&gt;
                &lt;artifactId&gt;mail&lt;/artifactId&gt;
                &lt;version&gt;1.4&lt;/version&gt;
              &lt;/extraDependency&gt;
            &lt;/extraDependencies&gt;
          &lt;/configuration&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;properties&gt;
  &lt;tomcat.version&gt;8.0.48&lt;/tomcat.version&gt;
  &lt;/properties&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>JNLP FILE</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;jnlp spec="1.0+"
   codebase="http://localhost:8080/TCApp" 
  
  href="http://localhost:8080/TCApp/SO.jnlp"&gt;
  &lt;information&gt;
      &lt;title&gt;Hello World&lt;/title&gt;
      &lt;vendor&gt;Noel Joseph&lt;/vendor&gt;
      &lt;homepage href="http://localhost:8080/TCApp/display.html" /&gt;
      &lt;description&gt; Hello World&lt;/description&gt;
  &lt;/information&gt;
  
  &lt;security&gt;
      &lt;all-permissions /&gt;
  &lt;/security&gt;
  
  &lt;resources&gt;
      &lt;j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se"/&gt;
      &lt;jar href="SO.jar" /&gt;
      &lt;jar href="catalina-6.0.29.jar" /&gt;
      &lt;jar href="catalina-ha-6.0.29.jar" /&gt;
  &lt;/resources&gt;    
  
  &lt;application-desc main-class="com.N.VJ.App"/&gt;
  
  &lt;/jnlp&gt;
  </code></pre>