In his article Deploying Web Applications to Tomcat, James Goodwill writes: The steps required to "WAR-up" your /onjava web application and deploy it are as follows: 1. Change to the root directory of your web application. In this case the root directory would be TOMCAT_HOME/webapps/onjava/. 2. Archive the web application: jar cvf onjava.war . 3. Copy the resulting WAR file, onjava.war, to the TOMCAT_HOME/webapps directory. Whereas in the Sybex cert book, it says (p.119): The WAR file is usually stored in the context directory. So, in the previous step 3, we would copy it to TOMCAT_HOME/webapps/onjava. So who is right, or are they both right, depending on how you jar up? Alan
They are both right. When you deploy a WAR file in Tomcat, you put it underneath the webapps directory (webapps/onjava.war). However, when you deploy a web application as a directory, the contents of that directory needs to go underneath webapps/context (webapps/onjava). HTH Simon
Hi, you can place your wars in any orbitary location you want.only thing is you have to let tomcat know where it is to deploy properly.you have to give absolete path of the your war file. however 'TOMCAT_HOME/webapps' is the default path of webapplications. so every thing placed there will be referenced relitive to that directory so you dont need to give path. this concept is same for any application server not just tomcat. please look at the documentation at http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html
sharp shooter, and author
Joined: May 10, 2000
If you take a look at the server.xml file in the TOMCAT_HOME/conf directory you'll see how to set up these types of mappings between web applications and the directory in which they reside. For simplicity, you're often best off using the default webapps directory though. Cheers Simon
Joined: Dec 19, 2001
In server.xml, I changed: [Context path="/onjava" docBase="onjava" debug="0" reloadable="true" /] so that docbase="onjava.war" and it's working ok.
:-)thanks Simon and Satya (the link to the /manager was useful
Just wanted to share my experience which I learnt by making mistake. When you want to make the war file you have to go INSIDE your context dir and give the jar command. Otherwise, if you just stay one dir above of your context dir and make the jar command , the war file will have 2 dirs with the same name one inside another like this. canopy\canopy\[all your contents] Then your app will not work from war file.
Regards, Maha Anna
subject: Can you choose where to put the WAR file?