Article: Tomcat deployer in action »
FERDY CHRISTANT - OCT 22, 2005 (02:55:37 PM)
In my last article on Tomcat, I mentioned the Tomcat Deployer. Tomcat Deployer is a web application that comes with Tomcat5 that allows you to deploy applications without having to restart the server. Below is a short demonstration on how it works.
The first obvious thing is to write your code in your prefered Java IDE. Be sure to stick to the directory structure specified by the J2EE API. The Tomcat application developer guide does a good job of explaining this in an easy way.
Next, you export your project to a WAR (Web ARchive) file. I use Rational Application Developer for all my Java work:
You can of course also use an Ant task to build your WAR files. Once the WAR file is exported, open the Tomcat Deployer at:
Scroll down to the "WAR file to deploy" section, select your exported WAR file and click the "Deploy" button:
The Tomcat Deployer will return a message to indicate the status of the deployment:
Next it is time to test the deployment. This obviously completely depends on the structure of your application, or in fact your deployment descripter file (web.xml). I used the most simple HelloWorld project possible. This project contains a helloworld.jsp JSP file that outputs "Hello World". To run it, go to:
The HelloWorld project also contains a HelloWorld servlet that outputs "Hello World Servlet". To run it, go to:
As you can see, using the Tomcat deployer application is easy. It eliminates the need to restart the server each time you deploy an application. You can also remotely deploy applications, without having file system access to the Tomcat server.
You can download my sample HelloWorld WAR file here.