![]() |
|
ADSP 21xx
Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now? Please make a donation to help with maintenance. |
Tomcat Install HowtoNov 2004, Redhat 7.2!!! Please forgive me for the old Linux version, but this is an old server on the other side of the country and I did all of this remotely via SSH. This document should apply to any version of Linux and it can only be easier with a modern distribution! The Tomcat Java Applet Server installation is a bit problematic. In order to figure out what you need to do, to install it, you have to download a long laundry list of source packages from jakarta.apache.org and start reading. Then when you actually start the installation, the build script will download everything all over again from CVS... First of all, you need a Java development kit, then you need Apache Ant, which is used to build the whole thing and finally, you have to configure it. Download a Java Development Kit (JDK) release (version 1.4.x or later) from:
Set an environment variable JAVA_HOME to the pathname of the directory into which you installed the JDK release.
Install Apache AntDownload a binary distribution of Ant 1.5.x from:
Put Ant in a suitable spot and untar it:
Set some more environment variables
Build Tomcat 5.5 from SourceNote, it didn't quite work for me. It downloaded and compiled and installed everything, but there was no Tomcat binary anywhere to be found... Since I am running a prehistoric Linux kernel on this machine, I have to build everything from source. Binary downloads usually won't run and invariably find some darn thing to complain about, but with Tomcat I was fortunately proved wrong... Download the main build script from:
Get the tomcat source file with Ant and build the whole thing:
When you run this command, it will checkout the Tomcat 5 sources from CVS, as
well as download binaries to the /usr/share/java directory. It ends
with the following announcement:
Hmmm, I then ended up with a bunch of crud in /usr/share/java and zero information on how to proceed from there... Maybe someone else can enlighten me one day. Install a Binary version of TomcatI gave up with the source version and got a binary tar ball here: http://jakarta.apache.org/site/binindex.cgi Down at the bottom of that page, get Tomcat 5.5.4, file jakarta-tomcat-5.5.4.tar.gz Copy this file to /usr/local and untar it into directory jakarta-tomcat-5.5.4 In there, is a file called RUNNING.txt - read it. You need to set some environment variables:
Set them like this in /etc/rc.d/rc.local
Tomcat can be started by executing the following commands:
You can test Tomcat by going to this URL:
It actually worked on my old Linux and didn't complain about any C libraries. This is quite amazing and probably means that Tomcat is statically linked with everything it needs. Hook Tomcat up with ApacheYou need the mod_jk2 connector - most references in the documentation is wrong about the location of this connector and refers to the previous version. It is not in the Tomcat binary download file and is now distributed on its own. The connector is used to forward Java applet page requests to Tomcat. Tomcat can also process static pages, but Apache is faster with that. So, through the connector, Apache is used as a preprocessor to Tomcat The binary version didn't run on my old Linux and complained about a C library, so I had to build this infernal thing from source. By the way, you could also use mod_proxy or even Squid-cache to connect Apache to Tomcat. If I have to do this again, I'll probably use Squid - much easier and then you have an accellerator too. For what they are worth, here are the official mod_jk2 howtos:
These guides should be taken with a little salt, but that applies to any howto, including this one... You can find the mod_jk2 source here:
Untar it:
There is no useful documentation anywhere and all the docs that Google can find are outdated (Nov 04)... The subdirectories of this package are maximally confusing. It took one hell of a long time to figure out how to build this bloody module and once built, I had to search the disk for the output. The joker who did this should be clobbered with a clue-stick. Here is one whole day's frustrating work in seven easy steps:
If all went well, then you are now the proud owner of a freshly built Java connector. Configure Apache to load the Connector ModuleHere is an excerpt from httpd.conf: # Load mod_jk # LoadModule jk2_module modules/mod_jk2.so # First Virtual Host. # Do the module load changes to httpd.conf and restart apache to see what happens. Ensure that apache still runs before continuing:
Configure Apache and Tomcat to use the ConnectorFile jk2.properties is used on the Tomcat side. It's installation path in the $TOMCAT_HOME/conf directory. workers2.properties is used on the webserver side. For the Apache servers the default path is in the ServerRoot/conf directory. NOTE: Although JK2 has many things in common with mod_jk, the configuration is quite different, and all the directives should be inside the workers2.properties. This enables JK2 to have the same configuration file no mater what the web server it's connected to. The minimum configuration is the simplest one to make the JK2 working. The used channel will be socket, and lot of options are used by default. Both the Tomcat and web server are on the same computer. jk2.properties:
So, if port 8009 is OK, then we don't have to do anything to this file. That is all needed on the Tomcat side to configure the JK2. workers2.properties:
So, normally, we don't have to do anything here either. That's it, you can now restart Tomcat and Apache and access Tomcat from the Apache server.
Browse to http://localhost/examples/ Hmm, Apache gives a 404, can't find it... Bah! Humbug! Add a path to the configuration file to httpd.conf:
Reload Apache and test again:
404... Grrrrr... Wait a minute - that error message comes from Tomcat, not Apache - which means that the redirector works, it is just my example Java application that is bad... sigh! 'Hope this helps!
|
|
Copyright © 2005-2008, Aerospace Software Ltd., GPL. |