This is the report of my attempt to install Apache 2, Tomcat 4.0.4 and
link both together with mod_jk2.

Please note my attempt was not successful. With 3 or 4 more days of
searching the web I might have cracked it, but I don't have that much
time and must settle with tomcat-4.0.3 + apache-1.3 (with mod_jk), a
well tested combo which I got working before.
I'm posting this here so that all the hours that I spent on this do not
get totally wasted. Hopefully someone will spot the flaw and correct the
procedure.
I did have to perform a small hack to one of the mod_jk2 source code
java files (step 3.3 below). Not sure if due to my mistake, or an actual
bug in the source. I think I'll post a quick note of this to the
tomcat-dev list.

I'm running Red Hat 7.2, kernel 2.4.9-34, with Sun's JDK 1.4, Ant
version 1.4.1, GNU libtool 1.4, on a dual Intel P3-800 box.

I read many sources of information before and during my attempt, but the
most important was a page written by Simon Stewart, with detailed steps
of the installation (http://www.pubbitch.org/jboss/mod_jk2.html). I
tried to follow the steps as closely as possible.


Note: this is my personal log, the paths are the ones I chose for my
installation.
------------------------------------------------------------------------
----

1) Apache httpd (web server)
   will download, compile, and setup httpd 2.0.39
   
   1.1) Download httpd
        got httpd-2.0.39.tar.gz from
http://apache.mirrors.rossfell.co.uk/dist/httpd/
        
   1.2) Unzip and untar into tmp directory:
        # mkdir /tmp/apache-build (then copy the file to it)
        # gunzip httpd-2.0.39.tar.gz
        # tar xvf httpd-2.0.39.tar
        # mv httpd-2.0.39 /tmp/apache-build/.
        and zip the original again (will keep this archived for future
use)
        # gzip httpd-2.0.39.tar
   
   1.3) Configure the source tree
        # cd /tmp/apache-build/httpd-2.0.39
        # ./configure --with-layout=Apache --enable-module=most
--enable-mods-shared=most
        
   1.4) Build
        # make
   
   1.5) Install
        # make install
        
   1.6) Make sure libtool is installed
        # which libtool
        
        1.6.1) If it's not installed, get it from
ftp://ftp.gnu.org/gnu/libtool/libtool-1.3.5.tar.gz.
               and # ./configure 
                   # make
                   # make install
               then add it to the $PATH if install didn't do it already

2) Jakarta Tomcat
   will download, and setup the binary jakarta-tomcat-4.0.4
   
   2.1) Download tomcat
        got jakarta-tomcat-4.0.4.tar.gz from
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4/bin/
        
   2.2) Unzip and untar into tmp directory
        # mkdir /tmp/jakarta-tomcat (then copy the file into it)
        # gunzip jakarta-tomcat-4.0.4.tar.gz
        # tar xvf jakarta-tomcat-4.0.4.tar
        now we move the resulting directory into it's final destination
        # mv jakarta-tomcat-4.0.4 /usr/local/.
        jakarta-tomcat is now installed under
/usr/local/jakarta-tomcat-4.0.4
        
   2.3) Test standalone installation
        # cd /usr/local/jakarta-tomcat-4.0.0/
        # bin/startup.sh
        # lynx http://localhost:8080 (lynx or any other web browser of
your choice)
        the tomcat test page should appear
        # bin/shutdown.sh
        

3) Tomcat connector (mod_jk2)
   will download, compile and install jakarta-tomcat-connectors-4.0.4
   
   3.1) Download the source for the connector
        got jakarta-tomcat-connectors-4.0.4-src.tar.gz from
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4/src/
        
   3.2) Unzip and untar into tmp directory
        # mkdir /tmp/jakarta-tomcat-connector (then copy file into it)
        # gunzip jakarta-tomcat-connectors-4.0.4-src.tar.gz
        # tar xvf jakarta-tomcat-connectors-4.0.4-src.tar
        
   3.3) Build
        cd into source directory (jakarta-tomcat-connectors-4.0.4-src,
now called ${jtc.home})
        
        # cd util (${jtc.home}/util)
        # cp build.properties.sample build.properties
        # ant
        
        # cd ../jk  (${jtc.home}/jk)
        # cp build.properties.sample build.properties
        # vi build.properties
           add line on top
"catalina.home=/usr/local/jakarta-tomcat-4.0.4
           edit tomcat40.home line to read
"tomcat40.home=${catalina.home}"
           edit apache2.home line to read
"apache2.home=/usr/local/apache2"
        
        # cd ../coyote  (${jtc.home}/coyote)
        # cp build.properties.sample build.properties
        # vi build.properties
           edit catalina.home line to read
"catalina.home=/usr/local/jakarta-tomcat-4.0.4"
        # ant
        
        NOTE: at this stage I got the following compile error:
        [javac]
/tmp/jakarta-tomcat-connector/jakarta-tomcat-connectors-4.0.4-src/coyote
/src/java/org/apache/coyote/tomcat4/CoyoteServerSocketFactory.java:102:
createSocket(int,int,java.net.InetAddress) in
org.apache.coyote.tomcat4.CoyoteServerSocketFactory cannot implement
createSocket(int,int,java.net.InetAddress) in
org.apache.catalina.net.ServerSocketFactory; overridden method does not
throw java.security.KeyManagementException
        So I needed to edit the java file in fault, as described below:
        # cd src/java/org/apache/coyote/tomcat4/
(${jtc.home}/coyote/src/java/org/apache/coyote/tomcat4)
        # vi CoyoteServerSocketFactory.java
           the createSocket methods all throw IOException,
KeyStoreException, NoSuchAlgorithmException, CertificateException,
UnrecoverableKeyException, KeyManagementException
           but the overwitten methods do not thow most of those
exceptions.
           Edit the createSocket methods, all must throw only
IOException
        # cd - (${jtc.home}/coyote)
        # ant
        The build is now successful
        
        # cd ..
        # ant
        
        # cd jk/build/lib
        # cp tomcat-coyote.jar tomcat-jk2.jar commons-logging.jar
tomcat-util.jar /usr/local/jakarta-tomcat-4.0.4/server/lib/
        # cp tomcat-jni.jar /usr/local/jakarta-tomcat-4.0.4/bin
        
        # cd /usr/local/jakarta-tomcat-4.0.4/
        # vi conf/server.xml
           uncomment other connectors, including the Ajp13Connector
<Connector> section and add the following:
           
              <Connector
className="org.apache.coyote.tomcat4.CoyoteConnector"
                    port="8009" minProcessors="5" maxProcessors="75"
                    enableLookups="true" redirectPort="8443"
                    acceptCount="10" debug="0" connectionTimeout="20000"
 
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
                    />
        
        # cd
/tmp/jakarta-tomcat-connector/jakarta-tomcat-connectors-4.0.4-src/jk/
(${jtc.home}/jk)
        # ant native
        
        # cp build/jk2/apache2/mod_jk2.so /usr/local/apache2/modules
        # cp build/jk2/jni/libjkjni.so
/usr/local/jakarta-tomcat-4.0.4/lib
        
   3.4) Edit/Create configuration files
        
        3.4.1) httpd.conf
            # cd /usr/local/apache2
            # vi ./conf/httpd.conf
                add "LoadModule jk2_module modules/mod_jk2.so" to the
end of the existing 'LoadModule's
            
            check the configuration file
            # bin/apachectl configtest
        
        3.4.2) jk2.properties
            # cd /usr/local/jakarta-tomcat-4.0.4/conf
            create jk2.properties file and add it's content
                # vi jk2.properties
                    #---- jk2.properties

                    # list of needed handlers.
                    handler.list=apr,channelSocket,channelUnix,request
                    # Set the default port for the channelSocket
                    channelSocket.port=8009

                    # State where the UNIX domain socket is located
 
channelUnix.file=/usr/local/jakarta-tomcat-4.0.4/work/jk2.socket

                    # Dynamic library
                    serverRoot=/usr/local/apache2
 
apr.NativeSo=/usr/local/jakarta-tomcat-4.0.4/lib/libjkjni.so

                    #---- end of jk2.properties
                    
        3.4.3) workers2.properties
            # cd /usr/local/apache/conf
            create workers2.properties file and add it's content
                # vi workers2.properties

                    #---- workers2.properties

                    # Shared memory handling. Needs to be set.
                    [shm]
                    file=/usr/local/apache2/logs/shm.file
                    size=1048576

                    # Example socket channel, explicitly set port and
host.
                    [channel.socket:localhost:8009]
                    port=8009
                    host=127.0.0.1

                    # Example UNIX domain socket
 
[channel.un:/usr/local/jakarta-tomcat-4.0.4/work/jk2.socket]
                    tomcatId=localhost:8009
                    debug=0

                    # define the worker
                    [ajp13:localhost:8009]
 
channel=channel.un:/usr/local/jakarta-tomcat-4.0.4/work/jk2.socket
                    # To use the TCP/IP socket instead, just comment out
the above
                    # line, and uncomment the one bwloe
                    #channel=channel.socket:localhost:8009

                    # Announce a "status" worker
                    [status:status]

                    # Uri mapping
                    [uri:/examples/*]
                    #worker=ajp13:localhost:8009
 
worker=ajp13:/usr/local/jakarta-tomcat-4.0.4/work/jk2.socket

                    [uri:/status/*]
                    worker=status:status

                    #---- end of workers2.properties



4) Running Tomcat
# cd usr/local/jakarta-tomcat-4.0.4/
# bin/startup.sh

Using CATALINA_BASE:   /usr/local/jakarta-tomcat-4.0.4
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-4.0.4
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-4.0.4/temp
Using JAVA_HOME:       /usr/java/jdk


But Tomcat does not start as it should.
usr/local/jakarta-tomcat-4.0.4/logs/catalina.out probably lists the
problem


# more catalina.out
06-Jul-2002 21:37:54 org.apache.jk.server.JkMain init
INFO: Starting Jk2, base dir= /usr/local/jakarta-tomcat-4.0.4
conf=/usr/local/jakarta-tomcat-4.0.4/conf/jk2.prop
erties
JK_LOG: [Sat, 06 Jul 2002 20:37:54 GMT] (error) [jk_config_file.c (261)]
config.update(): Can't find config fil
e ${serverRoot}/conf/workers2.properties
JK_LOG: [Sat, 06 Jul 2002 20:37:54 GMT] ( info) [jk_config.c (246)]
config.setAttribute() Error setting config:
 file ${serverRoot}/conf/workers2.properties

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4CF2CFCC
Function=apr_thread_mutex_lock+0x14
Library=/usr/local/apache2/lib/libapr.so.0

Current Java thread:
        at org.apache.jk.apr.AprImpl.initialize(Native Method)
        at org.apache.jk.apr.AprImpl.init(AprImpl.java:166)
        at org.apache.jk.server.JkMain.start(JkMain.java:285)
        at
org.apache.jk.server.JkCoyoteHandler.init(JkCoyoteHandler.java:142)
        at
org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.jav
a:1002)
        at
org.apache.catalina.core.StandardService.initialize(StandardService.java
:454)
        - locked <0x449a39c8> (a [Lorg.apache.catalina.Connector;)
        at
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:5
53)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:780)
        at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
        at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

------------------------------------------------------------------------
----

If anyone knows what's gone wrong, please feel free to add your ideas.

Due to lack of time I need to remove my 'attempted' installation and go
with a well tested combo, but will keep an interest in the tomcat 4.x +
apache 2 + mod_jk2 combo for future installations.

Regards

Daniel Farinha



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to