tomcat 557 on mac os x

Thu, Feb 24, 2005

OK, it’s time to update my ageing Tomcat. I was running 5.0.19 on Mac OS X but for some reason was getting strange Struts errors, such as not being able to embed bean:message tags inside html:link tags. It works fine on the G4 but not the G5.

First stop then is Tomcat central but what’s the story with the connector? Apparently mod_jk2 is dead, due to lack of developer interest! mod_jk2 is dead, long live mod_jk (again)

So what’s the latest mod_jk? That’s an easy question with no easy answer. The releases so far have gone: mod_jk 1.2.7 beta -> beta2 -> beta3 -> 1.2.8 rc1 what happened to the release of 1.2.7? and why would I want an rc? What is an rc? If it’s a candidate for release then it’s obviously not a proper release, so where is the proper release?

According to this page it’s mod_jk 1.2.6. OK, download that but what trickery is this? It expands to mod_jk 1.2.8! There is no 1.2.6 or 1.2.7!

Anyway, once the Tomcat versioning and docs hurdles are overcome it’s a simple case of following the instructions on the installation page. In short, for Mac OS X:

The two most important settings are: workers.tomcat_home=/usr/local/tomcat workers.java_home=/Library/Java/Home

Next we have to define a worker to handle requests transferred from Apache. I just deleted the default AJP12 and AJP13 workers as Tomcat seems to ignore everything after the first worker: worker.list=sgarbh

worker.sgarbh.type=ajp13 worker.sgarbh.host=localhost worker.sgarbh.port=8009 worker.sgarbh.socket_keepalive=1

This sets up a worker called “sgarbh” which you can use in your Apache virtual hosts to hook servlet requests. In fact, that’s what we’ll do now. Set up Apache to work with Tomcat.

So now we’ve defined a worker to handle servlet requests, loaded the connector into apache. What’s still required? We need to map virtual hosts or content areas within virtual hosts to tomcat workers:

The JkMount directive tells Apache to send all requests for http://test.uni.ac.uk/test-servlet to the tomcat connector called “sgarbh”, which we defined earlier in our /usr/local/tomcat/conf/workers.properties.

Next we have to fool around with aliases and paths. This is where you wished mod_jk2 hadn’t disappeared as mod_jk is not as easy to configure. To divert all requests to /struts to Tomcat, you’ll have to add this lot to you VirtualHost container: Alias /struts “/WWW/struts” <Directory “/WWW/struts/">   Options Indexes +FollowSymLinks </Directory> JkMount /struts/* sgarbh <Location “/*/WEB-INF/*">   AllowOverride None   deny from all </Location>

comments powered by Disqus