Thursday, April 04, 2002

Installing Tomcat 4 on Sun Cobalt (or probably any server for that matter)

This document will explain how to setup/install the Jakarta
Tomcat 4.x Java Application Server
. Because as we all know, Cobalt's
are kind of messed up and are even more messed up if you decide to install
the Cobalt JDK or whatever they call it. My recommendation... don't touch
the Cobalt supplied thing as this is somewhat similar to pulling out your
Desert Eagle and shooting yourself in the foot (am I playing too much
Tac Ops?). If you have installed it you can follow the directions below
with it still installed, but when you are done installing Tomcat 4, DISABLE
the JDK. The instructions on how to do this is in the Cobalt JDK manual/user
guide. Basically just comment out all the tomcat things that it put into
your httpd.conf file. Then setup the sites that require Java using the
Tomcat WARP protocol as explained below.


First get the latest stable release from the Jakarta site. Make sure
you get the tar.gz compressed binaries, not the zip (major problems).



Install as per instructions which are pretty basic. Check to make sure
it's running on port 8080.


Connecting Tomcat to Apache...


Now we'll need mod_webapp to use Warp, the new protocol. You can use
this precompiled file, mod_webapp.so (works
on raq4r and raqXTR) or you can build it pretty easily. To build it yourself,
download the mod_webapp source from http://jakarta.apache.org/builds/jakarta-tomcat-4.0/archives/v4.0/src/
. After extracting, run ./configure in the mod_webapp dir. Then mod_webapp
will end up in Apache 1.3 dir, so copy this to /etc/httpd/modules directory.


Then add this to httpd.conf:



LoadModule webapp_module modules/mod_webapp.so

AddModule mod_webapp.c


Somewhere above your virtual hosts, i put mine below all the other LoadModule
commands. Then put the following also above your virtual hosts.


<IfModule mod_webapp.c>

WebAppConnection conn warp localhost:8008

WebAppDeploy examples conn /examples


WebAppInfo /webapp-info

</IfModule>


Then from here you "should" be able to get at your examples
directory without putting the port in.


Then add the following inside each <VirtualHost ...> tag that you
want to be able to use Tomcat.



WebAppDeploy anyuniquenameyouwant
conn /


Notice this uses the same connection that we stated above in the WebAppConnection
statement. This is fine and good, you want to use the same connection
in most cases.


And now you need a matching Host in server.xml file in Tomcat/conf dir.
MAKE SURE you put this in the right section, not the Tomcat-Standalone,
but within:


<!-- Define an Apache-Connector
Service -->

<Service name="Tomcat-Apache">

Hosts go here


</Service>


Which should be at the bottom of your server.xml file.


Each site should have something like the following:

<Host name="www.spaceprogram.com"
debug="0" appBase="/home/sites/www.spaceprogram.com/web"
unpackWARs="true">


<Context path="" docBase="" debug="0"
reloadable="false" crossContext="false"></Context>

</Host>



This will load when user surfs to www.spaceprogram.com because we didn't
specify any path or docBase.


And that's about it I guess. If I missed something, let me know, I've
been pissing around with this for about 11 hours now and I was just about
to jump out my window, but then I finally got it working. And I am writing
down my recollections here so I hope I got it all.


Check out Bluerax
if you want a good Java host.