Saturday, May 24, 2008

Getting Started

For this project, I've decided that I'd like to learn more about a number of technologies, including:
  • JSP
  • Javascript/AJAX
  • Hibernate
I start by doing a quick search for JSP tutorials and found one at http://www.jsptut.com/. It informs me that in order to get started with JSPs, I need a compatible web server. I have chosen Tomcat because of my respect for and experience with other Apache projects. I'm working on a Mac, so with a quick search for 'mac tomcat' I find some (admittedly old) Apple documentation at http://developer.apple.com/internet/java/tomcat1.html. Its link to the Tomcat download page is out of date, but I'm able to follow some sidebar links to get to the new location. I download version 6.0.16.

I follow the tutorial's installation instructions. I only need to change a few file names (since the older version referenced doesn't have the same name or version number as mine) and I've got Tomcat up and running in a few minutes. The tutorial goes on to explain how to set up an example server. Some of the directory structure has changed between versions, and the information is presented in a somewhat confusing order, but I fairly quickly find the updated names and locations of files to use.

The tutorial mentions Ant, so I put that on my "to learn" list, but don't follow up on it now. I'll stick with the regular build tools for the tutorial (it actually recommends this). While compiling regularly adjusting the CLASSPATH is recommended; I end up having to hunt around a bit to figure out an up-to-date CLASSPATH that will work for me. This seems like something I might need to repeat a lot (or put in a login script) so I'll note it here:

export CLASSPATH="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar:/usr/local/apache-tomcat-6.0.16/lib/servlet-api.jar"

On my first try through the directions I get an error from the Tomcat server. There was a part of the instructions in the tutorial I skipped over because I didn't feel I understood it and I couldn't see a clear indication of its necessity; woe be to me. I go back and reread that section, hoping for a clue. Reading more carefully, I discover that a section of example code I had thought was just for me to read actually needs to be added to the server.xml configuration file. I open that file up, and discover that the format has changed significantly between the old version of Tomcat used in the tutorial and my up-to-date version, so I need to look for some more documentation.

Tomcat comes with documentation, so I access those docs directly on my local server. I end up at the development process guide (seen at http://tomcat.apache.org/tomcat-6.0-doc/appdev/processes.html). I decide to get Ant installed enough to follow this tutorial and abandon my older one.

It's easy enough to guess that the URL for Ant is http://ant.apache.org (since it's another Apache project). I download the latest version from http://mirrors.sirium.net/pub/apache/ant/binaries/apache-ant-1.7.0-bin.tar.gz. The installation instructions are a few clicks away from the download page and seem pretty straightforward. Since I'm adjusting PATH and other environment variables anyway, I take the opportunity to move the CLASSPATH setup from above into my .bashrc.

Now I'm back to following the Tomcat tutorial that came in the Tomcat documentation. Naughtily, I ignore the CVS steps for now, but only because this is a truly throw away exercise. When I get to the build.xml file, however, I realize that I'm not as familiar with Ant as the guide expects me to be. I decide to take a break and come back later when I'm ready to start a crash course in Ant.