I’m very new to Tomcat and I’m having some issues figuring out how to set it up. I set it up on Ubuntu Linux and started reading and trying to follow the information given on the apache website here: http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
Apparently I’m missing something. I have a WAR named MyWebapp.war and it’s in a directory /home/mywebapp. In /etc/tomcat6/Catalina/localhost/MyWebapp.xml, I have the following line:
<Context path="/MyWebapp" docBase="/home/mywebapp" antiResourceLocking="false" />
Everything else is the default configuration that came with tomcat6 via the Ubuntu package. When I restart Tomcat and try to go to http://localhost:8080/MyWebapp, I get a 404. The WAR file isn’t unpacked and nothing seems to be working.
I’m going to be deploying two Grails applications on this server with Tomcat.
Is there a more straight forward way to do this?
I find the most straightforward way to deploy a .war to Tomcat is to use the Manager Webapp.
All you need to do is follow the instructions linked above. Setup a user in the default memory realm
$CATALINA_BASE/conf/tomcat-users.xml. Navigate tohttp://myserver:8080/, log in with that user, deploy your app point-and-click style. Very handy, especially when you’re getting started with Tomcat.It also means you can deploy a war from your desktop, without having to manually copy it to the server.
Without using the manager webapp, you should be able to copy your war to
$CATALINA_HOME/webappsand it should be automatically deployed for you. You shouldn’t have to manually configure a Context for your app unless your app needs something like connection pooling resources setting up.