How to for apache2, tomcat4.1.x, mod_jk2, jsdk1.4 on Win2k
(Write to those who have been unable to success in win2k in Win2k) people)
Quick and dirty, no thinkion here for Those Who Just Want to Blast It in.
Note: In an effort to reduce convoluted path names in windows try to choose install directories with short names Also try not to use spaces in the names, Apache and Tomcat and as far as I know all XML files have problems with it and require you. To Double Quote Any Path Name That Includes Spaces. Save Yourself Some Headaches and Just Don't do it.
Note:. Careful planning of installation paths can be a good thing For instance, combining the DocumentRoot of Apache and the webapp directory of Tomcat can lead to automatic application configuration by Tomcat 4.1.10 I have not tried it so it's just a theory. Mind you, but it sods good.
Install J2SDK1.4.x
J2SDK
(Make Sure You get the Windows Version, Of The Latest Available, But It Should Work with ANY 1.4 Version)
No need to install src or demos. You will need to check the "JRE for windows drive only" option unless you want to edit the registry and point the key to the jvm.dll in the JDSK. It's easier to go ahead and take the DEFAULT THOUGH. NO MATTER WHERE You Choose To Install The JSDK Sun's Install Still Puts The Jre In The "Program Files" Directory. i Chose An Install Path of C: / Java. SO Try To Keep It Simple.
Set System Environment Variables for Java HOME.
Java_home = C: / Java
Add Java_Home and Java_Home / Bin Directory to the System Path Variable in My Case IT IS
C: / java; c: / java / bin
Install apache 2.0.43
Apache2
Get the latest available. Download the correct program for your system. The one ending in .exe is for people who do not have the msi installer yet, most do, so the smaller .msi package should work for most people. Make a nice short path without blank spaces for the installation Mine is C any:.. / Apache2During installation set domain and ServerName to Your Server Name or just localhost if you're just testing It will only be accessible from the local machine.
Install Tomcat 4.1.x
Tomcat
Get The Latest Release Version. At The Time of this Writing It WAS 4.1.12. You Must Get The Le Version of Tomcat. JDK 1.4.x Has An XML Parser Installed So The Le Version of Tomcat Was Made for this Reason. During Installation You don't have to select the check box for nt service. Again make Sure to Choose a Nice Short Install Path Without any blanks in the names. Mine is C: / Tomcat
Set System Environment Variables for Tomcat Home. It might also be a good idea to add a catalina home too.
Tomcat_home = C: / Tomcat
Catalina_Home = C: / Tomcat
Install and configure mod_jk2.dll
MOD_JK2.DLL
Get the latest version of mod_jk2.dll and save it to the APACHE_HOME / modules directory. The new modules are version named to ID them to different Apache versions. You can rename them to mod_jk2.dll or change the LoadModule statement to match the version you Are Installing. in Either Case The Module Name and The LoadModule Statement Have To Match. i Just Renamed The Module To Be Mod_jk2.dll.
In Your Httpd.conf File Add this loadModule Statement to the beginning of the loadingmodule section.
LoadModule JK2_Module Modules / MOD_JK2.DLL
In Your Apache_Home / Logs Directory You Will Need To Create Three Empty Files.
STDOUT.LOG
stderr.log
Jk2.shmadd workers2.properties
Cut and paste the following workers2.properties file inten the apache_home / conf Directory. There's Lots of extra stuff to experiment with here late. (Edit Paths to Suit)
[logger]
Level = Debug
[config:]
#file = $ {serverroot} /conf/Workers2.properties
FILE = C: /Apache2/conf/Workers2.properties
Debug = 0
Debugenv = 0
[UriMap:]
INFO = Maps the Requests. Options: Debug
Debug = 0
# Alternate File Logger
# [Logger.File: 0]
# level = debug
#file = $ {serverroot} /logs/jk2.log
[shm:]
INFO = Scoreboard. Required for reconfiguration and status with multiprocess Servers
File = $ {serverroot} /logs/jk2.shm
SIZE = 1000000
Debug = 0
Disabled = 0
[workeenv:]
INFO = Global Server Options
TIMING = 1
Debug = 0
# Default native logger (apache2 or win32)
# can be overriden to a file logger, useful
#hen Tracing Win32 Related Issues
# Logger = logger.file: 0
[lb: lb]
INFO = Default loading balancer.
Debug = 0
# [lb: lb_1]
# info = a second load balancer.
# debug = 0
[Channel.socket: Localhost: 8009]
INFO = ajp13 forwarding over socket
Debug = 0
Tomcatid = localhost: 8009
# [channel.socket: localhost: 8019]
# info = a second Tomcat Instance.
# debug = 0
# Tomcatid = localhost: 8019
# lb_factor = 1
# group = lb
# group = lb_1
# disabled = 0
# [Channel.un: /opt/33/work/jk2.socket]
# info = a second channel channeling to localhost: 8019 Via UNIX Socket
# Tomcatid = localhost: 8019
# lb_factor = 1
# debug = 0
[channel.jni: jni]
Info = The Jni Channel, Used if Tomcat is Started Inprocess
[status:]
Info = Status Worker, Displays Runtime Informations
[vm:]
Info = Parameters use to load a jvm in the server process
# JVM = c: /jdk/jre/bin/Hotspot/jvm.dllopt=-djava.class.path=c: /tomcat/bin/tomcat-jni.jar; C: / Tomcat / Server / lib / commit-logging .jar
Opt = -dtomcat.home = $ {tomcat_home}
Opt = -dcatalina.home = $ {tomcat_home}
OPT = -xmx128m
# OPT = -djava.compiler = none
Disabled = 0
[worker.jni: onstartup]
INFO = Command to Be Executed by The VM on Startup. This One will start Tomcat.
Class = ORG / APACHE / JK / APR / TOMCATSTARTER
Arg = start
Disabled = 0
Stdout = C: /Apache2/logs/stdout.log
STDERR = C: /Apache2/logs/stderr.log
[worker.jni: onshutdown]
INFO = Command to Be Executed by The VM on Shutdown. This One will stop Tomcat.
Class = ORG / APACHE / JK / APR / TOMCATSTARTER
Arg = STOP
Disabled = 0
[URI: / jkstatus / *]
INFO = Display Status Information and Checks The Config File for Changes.
Group = status:
# [Uri: 127.0.0.1: 8003]
# info = example Virtual host. make surevirtualhost is in / etc / hosts to test it
# alias = myvirtualhost: 8003
# [URI: 127.0.0.1: 8003 / EX]
# info = example Webapp in The Virtual Host. It'll Go To LB_1 (I.E. Localhost: 8019)
# context = / EX
# group = lb_1
[URI: / Examples]
INFO = Example Webapp in The Default Context.
Context = / example
Debug = 0
# [uri: / examples1 / *]
# info = a second Webapp, this time going to the second tomcat only.
# group = lb_1
# debug = 0
[URI: / Examples / Servlets / *]
INFO = prefix mapping
[URI: / EXAMPLES / *. JSP]
INFO = extension mapping
[URI: / example / *]
INFO = Map the whole WebApp
[URI: / Examples / Servlets / Hello)
INFO = Exampel with debug enabled.
Debug = 10
Add JK2.Properties
Cut and Paste the Following JK2.Properties File Into The Tomcat_Home / Conf Directory. (Edit Paths To Suit)
## this file may be overriden at runtime. Make sudu. Make tomcat is stock ##. You Edit the file.
## Comments Will Be _lost_
## documentation of the format in jkmain javadoc.
# Override The Default Port for the SocketChannel
# channelsocket.port = 8019
# Default:
# channelunix.file = $ {jkhome} /work/jk2.socket
# Just to Check if The config is working
Shm.file = c: /apache2/logs/jk2.shm
# In Order To Enable Jni Use Any Channeljni Directive
Channeljni.disabled = 0
# And one of the backing directives:
# apr.jnimodeso = / opt / apache2 / modules / mod_jk2.so
# I set to inprocess the mod_jk2 will register native itself
# This will enable the starting of the tomcat from mod_jk2
Apr.jnimodeso = INPROCESS
You Must Reboot To make all the variables active
Remember Tomcat Does Not Run As a Service In this Version SO You don't have to start it. It will start .. it. You Should Set The Tomcat Service To Manual and Not Automatic.
Yippee now we get to test it all, keep your fingers crossed Click on http:.. // localhost / examples If you have been very, very good and shared your candy with the other children then you should see the familiar tomcat example directory. If The Examples Worked The CHECK OUT The Extra Cool Jkstatus Page At http: // localhost / jkstatus
If not, welcome, you don't play well with start, erase everyhes and start over. Lol. J
Quick and dirty
Install the software, Get the Latest of Each
J2SDK 1.4
Apache2
Tomcat
MOD_JK2.DLL
1. Take all the defaults during installation, except for the install paths Choose custom install and change the Apache install directory to C:. / This will in fact install it to c: / Apache2, and Tomcat to c: / Tomcat, java to C: /java.2. Stop apache and place mod_jk2.dll in the apache_home / modules directory.
3. Edit httpd.conf, add loadingModule JK2_Module Modules / Mod_jk2.dll to the end of the loadmodules section.
4. Add System Environment Variables and Modify System Path.
Catalina_Home = C: / Tomcat
Java_home = C: / Java
Tomcat_home = C: / Tomcat
Add to System Path C: / Java; C: / Java / Bin
5. Add a jk2.properties file to tomcat_home / conf AND edit paths. File is here, use with no change.
6. Add a workers2.properties file to apache2_home / conf AND edit paths. File is here, do not change.
7. Create Three Empty Files in the apache2_home / logs directory
STDOUT.LOG
stderr.log
JK2.SHM
8. Reboot system.
9. Give it a whirl http: // localhost / example
IF you have trouble
If Apache fails to start, and it was fine before you started this, then there is probably something wrong with the LoadModule line you added to the httpd.conf. Open a cmd window in the bin directory of Apache and type in "apache -t "without the quotes. This will check the syntax of the httpd.conf file. If the LoadModule syntax is correct you may have the wrong mod_jk2.dll installed. It should throw an error complaining about incorrect versions in the cmd window.
Review the Apache error log to see problems with the in-process startup of Tomcat. If it complains about not finding the jvm.dll and can not finish the vm setup or says there's no installed jvm.dll in the path then check to make .. sure the JRE got installed correctly Tomcat reads the registry to find the location of the jvm.dll For example since I took the defaults during the installation of J2SDK my registry shows the installed JRE at; [HKEY_LOCAL_MACHINE / SOFTWARE / JavaSoft / Java Runtime ENVIRONMENT / 1.4.0_01]
"Javahome" = "c: / program files / java / j2re1.4.0_02"
"Microversion" = "0"
"Runtimelib" = "c: / program files / java / j2re1.4.0_02 / bin / client / jvm.dll"
Navigate to the indicated RuntimeLib directory and see if it's actually there. If everything thing looks fine and it still throws errors then you can point mod_jk2 to it with a path statement in the [vm] section of the worker2.properties file, but normally this Is Not needed.
MOD_JK2 Can Tell You Allot About Your Installation and Configuration. You can see what it think at http: // locahost / jkstatus.
Check the stdout and stderr log more clues, pay attention to the [error] Lines, [WARNING] Are OK.
Other problems I've seen is jk2 complaining thing it can't Find the class path for tomcat starter, this turned out to be a mangled mod_jk2.dll and was fixed by simply repla acquiocing the file.
If you get errors about AJP13 forwarding then check your jk2.properties file for a "channelJni.disable = 0" statement. Jni has to have a channel statement to run. Any channelJni statement will do, the previous one simply says it is not disabled .
Did you remember to reboot? More than once I have forgotten this simple step, and without it Tomcat will not be able to find the jvm.dll or any of the other java stuff.Double-check your environment variables for the correct paths. Make sure you have a tomcat-jni.jar in the TOMCAT_HOME / bin directory. Make sure the paths are correct in the jk2.properties and the workers2.properties file. The path for the jk2.shm should be correct, especially important if you have Multiple Processors.
BTW, if you use this "How to" and Improve On It, How's About Sharing It Back with Me. RSowders@usgs.gov
I put this together after Lurking On Tomcat-Users and Picking Up Some Pointers from Malden Turk, Andy Eastham, And Lots of Others.
Robert Sowders
Senior UNIX Administrator
Western Geographic Science Center
rsowders@usgs.gov
List of things you'll nesed.
J2SDK 1.4
http://java.sun.com/j2se/1.4/download.html
Apache2
http://www.apache.org/dist/httpd/binaries/win32/apache_2.0.40-win32-x86-no_ssl.msi
Tomcat 4.1.10-le
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/test/v4.1.10/bin/jakarta-tomcat-4.1.10-le-jdk14.exe
MOD_JK2.DLL
Http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/nightly/win32/mod_jk2.dll
Get Some Humor Too, Sometimes It Helps to Take A Break and Laugh at Yourself.
http://www.despair.com/risks.html
http://www.despair.com/hazards.html
Http://www.despair.com/fut24x30prin.html