Incorrect Blitz Input

James Swetnam’s weblog

Installing Apache Tomcat 6 on OS X

Apache Tomcat is an open source web framework (or “servlet container”, in javaverse lingo) for deploying JSP-powered web applications. I needed to get a local copy running on my PowerBook in order to develop a better search engine for Molsoft’s ICM documentation pages– more on that later. At the end of this guide, you should have a complete Tomcat installation running with the manager application enabled.

Warning: There’s a great, but deprecated, tutorial on ADC that this guide borrows heavily from. That said, I do not advise following the ADC tutorial, as the setup of Tomcat has changed a great deal between the version in use at the time of the tutorial’s writing in 2001 (4.0.1) and the current version (6.0.14).

Okay, let’s get going. First, grab a copy of the latest tomcat 6.x tarball .

We’re going to check the md5sum of the downloaded tarball just to make sure we got what we ordered. I neglected to do this on the first go-round, and ended up with a distribution that was missing the manager webapp. Figures.

md5 apache-tomcat-6.0.14.tar.gz

Make sure the md5 hash that this command spits out is the same as the one provided next to your download link. If it’s not, try another mirror.

Extract the tarball in your /usr/local/ directory, or to wherever you want to install Tomcat.

sudo sh
mv apache-tomcat-6.0.14.tar.gz /usr/local/
cd /usr/local
tar zxvf apache-tomcat-6.0.14.tar.gz
rm apache-tomcat-6.0.14.tar.gz

Let’s go ahead and change the ownership of the tomcat directory so that we don’t have to type sudo anymore.

chown -R [user]:staff apache-tomcat-6.0.14

Hey, you have a fully functional Tomcat install on your system now! Let’s write some control scripts to get it running. (This is where we begin to depart from the ADC tutorial… Note that the JRE install location has changed.)

cd
mkdir bin
cd bin

Edit a file called tomcat_start in this directory, and copy the following lines into it:

#!/bin/sh
export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14
export JRE_HOME=export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14
export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
$CATALINA_HOME/bin/startup.sh

Save tomcat_start. Now edit a new file, stop_tomcat, with the following lines:

#!/bin/sh
export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14
export JRE_HOME=export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14
export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
$CATALINA_HOME/bin/shutdown.sh

Save this file, too. Now make both files executable:

chmod +x start_tomcat stop_tomcat

And go ahead and start Tomcat.

./start_tomcat

Open http://localhost:8080/ in your browser and you should see a nice, locally served Tomcat page that should look something like this:
tomcat_init.png
That wasn’t so hard. Let’s roll up our sleeves and fire up the web interface for the manager application to do our first install: http://localhost:8080/manager/html/.
picture-5.png
Whoops! 404. Looks like we’ve got some configuring to do. It’s not too bad, though. All we have to do is add a user to the tomcat-users.xml file located under /usr/local/apache-tomcat-6.0.14/conf. Add the following line in between the “tomcat-users” tags with your own username and password:

<user username="admin" password="secret" roles="standard,manager"/>

Save the file and exit. We now need to restart tomcat in order for our configuration change to take effect. Let’s stop and start our server:
~/bin/stop_tomcat
~/bin/start_tomcat

Now Reload http://localhost:8080/manager/html/ and you should get something similar to this:

Manager Webapp

Now you’re set up with a fully functional Tomcat install. If you’re ready for more, try plumbing the depths of the Tomcat documentation for the 6.x series. It’s a bit aimless, but it’s very informative and worth a careful read. The Application Developer’s Guide is a good place to start.

EDIT: Special thanks to Pete Ludwig for pointing out the necessary restart after the change to tomcat-users.xml.


If you’re really interested in getting a solid understanding of both the particulars of the tomcat framework AND learning the JSP system thoroughly, think about getting yourself a copy of “How Tomcat Works” by Budi Kurniawan and Paul Deck. Don’t let the title turn you off; this book contains thorough treatment of not only Tomcat, but JSP and servlet programming in general.

A Problem with Gift Cards

bp-giftcard_ex.jpg
Here’s a problem I’ve developed with gift cards since moving to New York and developing a distaste for the chain stores that are sucking out its culture– stores like the Banana Republic in the West Village, the Starbucks in Park Slope, and the American Apparel in Williamsburg.

What’s my beef with gift cards? Since their usefulness varies directly with the number of store locations of the issuing retailer, people are more likely to buy gift cards from bigger companies. So, the growing popularity of gift cards means more and more money goes to bigger stores. So far, Barnes & Noble has earned $75, Borders $25, Best Buy $25, and Starbucks $25, just from gift card sales in my name. This is $150 I might have spent at independent retailers like Alabaster Bookshop, The Strand., or the Tea Lounge. That’s a lot of money!

This isn’t to say I’m not grateful for the gift cards I did receive– I do appreciate them very much and am looking forward to buying all sorts of fun things with them. You can’t be blamed for buying a gift card from a chain store if you want to make sure someone far away can use the money!

For next year, I’m going to look into gift cards from local retailers. A Google search turned up Booksense , which looks like a program that bookstores can enroll in that includes a gift card that’s accepted by most of the participants. I think the Strand has it’s own gift card, and I’m sure I might be able to find a coffee shop or two that has one as well.

If a Starbucks ever appears in Bedford-Stuyvesant, I’ll give up. Can you imagine buying a Venti White Chocolate Mocha through a rotating carousel of bulletproof plastic?

Bathroom Dance Humor

Spotted in the men’s room of Sandra Cameron Dance Studio:img_0066.jpg

Fink Lacks rsync Support for Leopard

Just like the title says, Fink doesn’t support rsync selfupdating under Leopard yet. The fix is easy, though. Instead of issuing:
sudo fink selfupdate
Type:
sudo fink selfupdate-cvs

And everything should be fine.

« Previous Page

Mexico