Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Deployment of application by a newbie that is an oldster.

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, this oldie has a newbie question.

I've tried to read the documentation and maybe you younger people get it, but I'm getting glassy eyed and don't get it. The problem is I can't figure out how to take my war file from RAD and deploy it in TOMCAT 6. I thought I just had to put a war (and I included the zip file in case it was needed) in C:\Program Files\Apache Sortware Foundation\webapps\root\FSCalc.war.

I then opened and checked that Tomcat was running by opening a browser and going to http://localhost:8080/ and I do see the Tomcat page.

I then entered: http://localhost:8080/FSCalc and got a 404 error.

1) was that the right place to put the war file?
2) what else was I doing wrong.

I saw in the doc that normally while developing you could use the file system instead of a war file, but I got lost in the different places that needed unknown changes to make that work.

Any help would be greatly appreciated.

Saloon Keeper
Posts: 22118
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would have been better to ask these kinds of questions in the Tomcat forum, actually. Eclipse/RAD can help build a WAR, but once that's done, Tomcat neither knows nor cares where the WAR came from.

When you have a WAR in unzipped form, it's known as an "exploded WAR". Tomcat supports that and will even explode WARS as part of the deployment depending on the Tomcat server options and what release of Tomcat it is.

There are several ways to deploy a WAR (exploded or otherwise) into Tomcat.

1. Drop a copy into the TOMCAT_HOME/webapps directory (NOT webapps/root!)

2. Drop a context XML file into TOMCAT_HOME/webapps

3. Create a context XML file in TOMCAT_HOME/conf/Catalina/localhost

I use method #3, since it allows me the ability to build my exploded WAR in my Eclipse workspace and point the context XML to that directory without having to copy it. Plus, Tomcat will hot-load changes to the Eclipse copy. If you use method #1, the context URL is synthesized to be the same as the WAR name, since you don't have a Context to specify an alternate name. You also won't have the advantages of being able to externally configure the webapp if you don't define a context XML, since that's where you'd put the database connection pool definition, security realm definition (if securing per-webapp) and JNDI object definitions/overrides.

Older versions of Tomcat would store context definitions in the TOMCAT_HOME/server.xml file. Don't do that. It still works, but isn't as flexible.
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic