I always try and find the simplest development environment I can. Even though there are a lot of tools out there, it never hurts to have something really simple. That is why I love my little Ant J2EE environment with Tomcat. My little template is called simple_tomcat.zip and it has a database, a JSP template, a set of must-have jars, and all the nasty JNDI stuff pre-configured. To run it, unzip the file, change to the directory called "ant", run ant, and point your browser at your local machine. You will see a page with the JNDI connection and a quick link to a Struts starter kit.
I remember when Tomcat had a lot of sex appeal. This was before JBOSS and Orion. The nearest thing to Tomcat was JRun, and it sucked. I really wonder if the dot.com fiasco would have been less painful had more people avoided JRun? Anyway, JRun is history and Tomcat is on version 5.
The other nifty thing about Tomcat is that if you know the hell of out it, you can move easily to other servlet containers, and the best way to learn the hell of something is to use it at its most basic level.
So enough talk, here I will describe the contents of a zip file that contains the minimal kernal of an enterprise class environment.
A Database - Fire your overpaid Oracle DBAs and use Hypersonic SQL
When you set up ant, always use a build.properties file and don't put path information into your build.xml file. That way, when someone downloads your code, they only have to change the configuration parameters and away they will go.
In the ant/build.properties of the zip file, you will need to change the following lines:
# For compiling JSP
tools.jar=d:/java/j2sdk1.4.2/lib/tools.jar
# Tomcat
servlet.jar=D:/java/jakarta/tomcat-4.1.27-le/common/lib/servlet.jar
tomcat.home=D:/java/jakarta/tomcat-4.1.27-le
...
The other libraries in the file use relative paths and I distribute those libraries, so you don't have to hunt them down. I basically include everything that I described in Building an Enterprise Environment with Free Software
Now the trick to getting high productivity with Tomcat is to use Ant to run it, so that you have a very quick turn around time between idea, code, compile and test. In the ant build file, I simply run Tomcat as a Java program and use the fact that it is designed to be able to run multiple clustered instances with different work directory. Scroll through the build.xml file and view the target named tomcat for details.
The other trick is to configure the JNDI context and the JDBC context reference. Do this in the src/etc/tomcat/server.xml file and make sure you watch the log for problems. It is easy to make mistakes in creating the JNDI context and it can be hard to figure out why you don't get a data source. To get the JNDI configuration right, it is best to just run the example and change the parameters to suite whatever database strikes your fancy.