Incerteza
Incerteza

Reputation: 34934

Cannot deploy an apache tomcat web application - always 404

I've got bitnami tomcat installed on Amazon EC2. And I have 2 .war files, the old.war and new.war one, there're generated from the same web app, but the 2nd one is supposed to work more properly, or rather, accurately. Also the 2nd one is generated by myself (jar -cvf my_new.war *) and I have the its sources whereas the 1st by someone else.

I put them in /opt/bitnami/apache-tomcat/webapps. The 1st one is working well, at least in the sense that the webapp gets accessible from the internet at http://ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com/old/, unlike the new one which always returns this at http://ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com/new/:

enter image description here

To recap: At EC2 I deploy them the exact same way. Maybe I don't generate the new.war properly?

What could be the reason? P.S.

One of the logs say this

Sep 28, 2015 4:41:19 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Sep 28, 2015 4:41:19 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Sep 28, 2015 4:41:45 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet myAppServet as unavailable
Sep 28, 2015 4:41:45 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [myAppServet] in web application [/my_app] threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
  at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506)
  at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488)
  at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  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:652)
  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095)
  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1930)
  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
  at java.util.concurrent.FutureTask.run(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)

Sep 28, 2015 4:41:46 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 28, 2015 4:41:46 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Sep 28, 2015 4:41:46 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@528a709d')

I've changed the original name to my_app in this log. Why isn't it found? What exactly not found?

Upvotes: 0

Views: 1039

Answers (1)

ionic
ionic

Reputation: 46

Since I don't have enough reputation yet to put a comment, I'll say this here. One possible reason is that your WAR file wasn't exploded (extracted). Can you check if your webapps/ directory has webapps/new/ directory? If not one thing to try is restart Tomcat.

Also, it's better if you use Tomcat manager when deploying WARs and not copying them manually to the webapps directory. That will ensure that WAR files are exploded. If it fails, you'll get an error message right away. Usually the manager app is accessible via http://localhost:8080/manager in a local installation of Tomcat, so most likely it's in http://ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com/manager in your case.

Upvotes: 1

Related Questions