Ubuntu – Deploying war files in tomcat6

directorypathsservertomcat

I am using tomcat5.5 for a long on Ubuntu servers 8.10 and 9.10 and /usr/share/tomcat/webapps/ is the path where I place my .war files and access them on the browser over network.

On a sytem I've installed tomcat6 and I'm failing to find that where do I place my .war file of tomcat6's webapps. I checked deploying war under /var/lib/tomcat6/webapps/ and the war file is extracted and I think this should be the location but I could not access the page when I tried http://serverip:8080/myapp. I could access the default page properly when I navigate to http://serverip:8080. The same war file is working fine on tomcat servers which were not installed from apt repository.

Log Messages:

INFO: Stopping Coyote HTTP/1.1 on http-8080
2 Dec, 2010 10:06:29 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2 Dec, 2010 10:06:29 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 523 ms
2 Dec, 2010 10:06:29 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2 Dec, 2010 10:06:29 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
2 Dec, 2010 10:06:30 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive myapp.war
2 Dec, 2010 10:06:32 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2 Dec, 2010 10:06:32 AM org.apache.catalina.core.StandardContext start 
SEVERE: Context [/myapp] startup failed due to previous errors
2 Dec, 2010 10:06:32 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2 Dec, 2010 10:06:32 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3110 ms
2 Dec, 2010 10:06:39 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2 Dec, 2010 10:06:39 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/myapp] startup failed due to previous error

Any help?

Best Answer

You'll need to use the "manager web-app" to deploy the war file.

  • First: create a manager user for tomcat6. Edit /var/lib/tomcat6/conf/tomcat-users.xml and add something like the following (remember to use a unique password):

    role rolename="admin"

    role rolename="manager"

    user username="admin" password="password" roles="admin,manager"

    (Note: look at the examples in /var/lib/tomcat6/conf/tomcat-users.xml. These lines are tags but I can't post tags on AskUbuntu :( Hopefully, it's not too confusing.)

  • Next: restart tomcat:

    $sudo /etc/init.d/tomcat6 restart

  • Finally, open http://localhost:8080/manager/html and log-in with the username and password that you just set. On the bottom of the page, there's a dialog box that lets you select and deploy a war file.

HTH

Related Question