amazon-ec2clojuretomcat7leiningenpedestal

Tomcat 7 fails to deploy on EC2 instance due to Exceptions


I have built my pedestal app according to following

https://github.com/pedestal/pedestal/blob/master/guides/documentation/service-war-deployment.md

and then I upload the .war file and deploy it.

however, when I ssh in to the ec2 instance I found that it did not deploy successfully even though it says so

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs durin$ May 31, 2016 2:09:52 AM 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:153)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: org/apache/tomcat/util/descriptor/tld/TldParser
        at org.apache.jasper.servlet.TldScanner.<init>(TldScanner.java:86)
        at org.apache.jasper.servlet.JasperInitializer.newTldScanner(JasperInitializer.java:120)
        at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5573)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        ... 10 more Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.descriptor.tld.TldParser
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
        ... 15 more

May 31, 2016 2:09:52 AM 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:903)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)


May 31, 2016 2:09:52 AM org.apache.catalina.startup.HostConfig deployWAR INFO: Deployment of web application archive /var/lib/tomcat7/webapps/ROOT.war has finished in 6,440 ms 
May 31, 2016 2:09:52 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] 
May 31, 2016 2:09:52 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] 
May 31, 2016 2:09:52 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 6530 ms

I'm thinking this is pedestal specific because I successfully deployed a clojure ring web app packaged into war without problems.


Solution

  • From looking at the stack trace it seems that this class is missing: org/apache/tomcat/util/descriptor/tld/TldParser.

    It is possible that the uber-war you are supplying still has Tomcat classes in it. The instructions you link to say to remove Tomcat dependencies:

    [io.pedestal/pedestal.tomcat "0.1.0"] 
    

    I am guessing that EC2 supplies its own Tomcat, and if you were not supplying any conflicting classes, you would not be getting that error.

    You can use any zip/archiving tool to look inside the war and verify that you have removed Tomcat completely: it is just a zip file after all.