Friday, May 7, 2010

Jetty in the shell but Tomcat in the Ghost

We are wrapping up this course. I am calling this entry "Jetty in the shell but Tomcat in the Ghost" because I am a fan of the "Ghost in the shell" anime series. If that doesn't make sense don't worry, it just means that you are missing a few neurons.

We are going to talk about our deployment options for our Tapestry5 web application. We could continue using Jetty or we could shift to the more familiar Tomcat. You could make a point by arguing for other web application servers like JBoss and such. Well, JBoss uses Tomcat, so the point is moot. This entry is about deploying our seemingly done addressbook with Tomcat. 

The first thing we need to do is pack away our project into a web application archive file or more commonly called a WAR file. Creating a WAR file in Netbeans is easy.


Right-click on our project and select either "Build" or "Clean and Build".

Wait for it to finish - you can track its progress in the output window if you want.

When finish go to the project folder and locate the target folder. Open it and there should be file named AddressBook.war. This is what we will install into Tomcat.

So, how do we deploy (or install) our application into Tomcat. There are two ways of doing this:

1. You can simply copy the AddressBook.war file into the webapps folder within the Tomcat path. Tomcat will detect it and deploy the new web application using the filename as context. So in our case it will be deployed to /addressbook relative to the URL.

2. or use the Tomcat manager to deploy it.

Now this is roughly half the job. The other half is about setting up the mySQL database and configuring Apache. If you have gotten this far, you could do that already.

So, from start to finish - a working Tapestry5 application. I hope you find this useful and inspire you to do great and wonderfull things with Tapestry.

No comments:

Post a Comment