title: Trouble deploying my webapp to Tomcat7
body: <p>This is my first effort deploying my own App to a remote tomcat server. I've searched and searched my problem and can't find a solution.</p>
  
  <p>I created a Maven project in eclipse with the <code>webapp</code> archetype. My local tomcat installation is listening on <code>port 8080</code>, but I have the tomcat installation on my server listening on `port 80'. I've completed and tested my app in Eclipse with Maven and Tomcat, and it works just fine.</p>
  
  <p>I exported my project to a <code>.war</code> file and renamed it <code>ROOT.war</code>. Then, with the server stopped, I uploaded it into <code>/var/lib/tomcat7/webapps/</code>. Then I started the server and the <code>.war</code> file autodeployed into the <code>/var/lib/tomcat7/webapps/ROOT</code>. When I navigated to <code>www.myDomain.com</code> I got a "link seems to be broken" error from Chrome, and a 404 status code.</p>
  
  <p>I checked the logs and got this:</p>
  
  <pre><code>INFO: Deploying web application archive /var/lib/tomcat7/webapps/ROOT.war
  Sep 22, 2013 6:31:06 PM org.apache.catalina.startup.ContextConfig init
  SEVERE: Exception fixing docBase for context []
  java.util.zip.ZipException: error in opening zip file
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:131)
      at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:150)
      at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:87)
      at sun.net.www.protocol.jar.URLJarFile.&lt;init&gt;(URLJarFile.java:90)
      at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:66)
      at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:86)
      at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
      at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
      at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:112)
      at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:697)
      at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:820)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:363)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
      at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
      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:679)
  Sep 22, 2013 6:31:06 PM org.apache.catalina.core.StandardContext resourcesStart
  SEVERE: Error starting static Resources
  java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file
  </code></pre>
  
  <p>I tried re-creating the <code>.war</code> file and trying again, but with no luck. I read some articles explaining that this may be due to a corrupted war file (even though the file structure showed up on my server in full after restarting), so I decided to skip creating a <code>.war</code> file completely. I created a copy of <code>myWebappProject</code> that I called <code>ROOT</code>. Then I just uploaded the <code>ROOT</code> directory in my workspace directly to <code>.../webapps/ROOT</code>.</p>
  
  <p>After starting the server and navigating to <code>www.myDomain.com</code> and <code>www.myDomain.com/ROOT</code> and <code>www.myDomain.com/index.jsp</code> etcetera etcetera I got the stock error message from Tomcat reading <code>The requested resource (/ROOT/) is not available.</code> and variations thereof. There were no exceptions in the log files that provided useful feedback.</p>
  
  <p>The directory structure that I'm using is the default for a Maven project with the webapp archetype. </p>
  
  <p>Thanks in advance for your help. Let me know if there is any other code or log files I can post.</p>
  
  <p><strong>EDIT</strong>
  per @Aaron's recommendation, I tried unzipping the warfile myself and running again. More issues this time:</p>
  
  <pre><code>INFO: validateJarFile(/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/servlet-api-3.0-alpha-1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
  Sep 22, 2013 8:35:18 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:895)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
      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:679)
  Caused by: java.lang.UnsupportedClassVersionError: uploadServlet/Uploader : Unsupported major.minor version 51.0 (unable to load class uploadServlet.Uploader)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2840)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
      at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:381)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks everyone for the help so far.
  I downgraded to Java 1.6 on my development machine as my server is running Java 1.6.0_24. I also used Maven to create the <code>.war</code> file via <code>mvn package</code>. I'm still getting a 404 and the 'broken link' error from Chrome. Here is the server start-up log.</p>
  
  <pre><code>INFO: Deploying web application archive /var/lib/tomcat7/webapps/ROOT.war
  Sep 22, 2013 9:45:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
  INFO: validateJarFile(/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/servlet-api-3.0-alpha-    1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:    javax/servlet/Servlet.class
  Sep 22, 2013 9:45:53 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:895)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
      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:679)
  Caused by: java.lang.UnsupportedClassVersionError: uploadServlet/Uploader : Unsupported     major.minor version 51.0 (unable to load class uploadServlet.Uploader)
      at     org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2840)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
  at     org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2840)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
      at  org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSe t.java:108)
      at  org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java: 58)
      at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:381)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
      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:5161)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 11 more
  Sep 22, 2013 9:45:53 PM org.apache.catalina.startup.HostConfig deployWAR
  SEVERE: Error deploying web application archive /var/lib/tomcat7/webapps/ROOT.war
  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:898)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
      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:679)
  Sep 22, 2013 9:45:53 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOTBackup
  Sep 22, 2013 9:46:30 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
  INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took  [36,729] milliseconds.
  Sep 22, 2013 9:46:30 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-80"]
  Sep 22, 2013 9:46:30 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 37873 ms
  </code></pre>