Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deploying war file in dev server

Status
Not open for further replies.

alpaso

Programmer
Oct 30, 2003
9
US
I packaged the web app that I had created into a war file with jar cvf <war_file_name>.war . command and placed the .war file in the webapps directory.
I backed up my web app and stored it in another location (different drive)
I have added a Context entry in the server.xml file for let scall it &quot;MyApp&quot;.
When I stop and start Apache and navigate to the jsps or to te root directory it gives me the folowing error:

Apache Tomcat/4.0.1 - HTTP Status 404 - /Ter

--------------------------------------------------------------------------------

type Status report

message /MyApp

description The requested resource (/MyApp) is not available.

Restoring all the application files back into their uncompressed form and restarting TomCat serves up the jsps and the objects just fine.
What could be the reason?
 
I've never bothered with a context entry in server.xml.
All we do is dump your myapp.war in webapps and off you go - you would hit a URL like :
The URL context name has to be the same as the .war file name in this case though ...

If you want to hit &quot; then you need to add a <welcome-file-list> entry in your .war's web.xml ...
 
Thanks..
After I removed the entry in the server.xml it worked fine expanding all the application files into the webapps folder.
I still don't understand the conflict with the server.xml. IS

What are the cases when you need to make changes to the server.xml?
 
if you put a entry in the server.xml, tomcat assume the application is there already and will not expand its war file. But if the war file is there but no entry in server.xml, tomcat see a new app and will install it for you. So, either you do all installation (expand the war file, config the server.xml) manually or let tomcat do it.
 
Thanks for the response ! I appreciate it!
Now I have observed that even if you have an expanded app (no war file) it works even when you don't have a &quot;Context&quot; entry for it in the server.xml. It loads the app fine (confirmed by running command).

So what is the purpose of the entry? When do you really really need it? If it works without it, why have it there?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top