It's not a secret anymore!
The moose likes Tomcat and the fly likes Deploying .war Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Deploying .war" Watch "Deploying .war" New topic

Deploying .war

Sami Casab

Joined: Nov 28, 2001
Posts: 26

I have a .war file with some servlets and jsp (i dont have ejb). I tested it on hp-as ands works fine but i need to deploy it in a pure tomcat server but i dont know how to deploy it.
so, where do i should put this file? and how i deploy it? ...
Thanks in advance.
Jim Petersen
Ranch Hand

Joined: Jul 24, 2001
Posts: 241
Hi Sami
Here is one way to do it (as of TC version 3.2)
1. Stop Tomcat.
2. Delete an existing deployment (If you tried before and it went pear-shaped). If you previously deployed "foo.war" in TOMCAT_HOME/webapps, then it has been unpacked into webapps/foo/... You must delete this directory and all its contents.
On Unix, this can be done with
rm -r $TOMCAT_HOME/webapps/foo or
del %TOMCAT_HOME%/webapps/foo on Win
3. Copy WAR file to TOMCAT_HOME/webapps/.
Start Tomcat.
( A "deploy tool" apparently is on the Tomcat "to-do" list)
If you deploy a WAR file in this manner, you do not need to make any changes to server.xml -- its automatically recognized and activated. However, if you wish to specify non-default options for this webapp, you may do so by adding an element like
<Context docBase="webapps/foo" ...
to server.xml.

- Jim Petersen <br />SCJP2<br />SCWCD<p>- but then again, I could be wrong...
Sami Casab

Joined: Nov 28, 2001
Posts: 26
Thanks for you help, my servlet is now working under Now i am trying to configure my apache web server because i dont want to use the 8080 port, could you give me a tip?
Thanks in advace.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Sami. this URL might help ya:
it says how to change from port 8080 to 80

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
I agree. Here's the link:
subject: Deploying .war
jQuery in Action, 3rd edition