You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daniel Farinha <da...@neuron.co.uk> on 2002/07/06 23:47:27 UTC

tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed attempt

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed attempt

Posted by Lalit Pant <la...@yahoo.com>.
Tried to get Apace-2.0.39 + Tomcat 4.x working based on the pointers here,
and I must say I did not have too many problems. Fyi, I just built the
native portions of the connectors (mod_jk.so, mod_jk2.so), and got mod_jk.so
to work with (the binaries of ) Tomcat 4.0.4 and and 4.1.5 on multiple
machines. I did not try to configure mod_jk2!

Here's a summary of what I did...

Step 1
--------
make and install Apache 2.0.39 into /opt/apache2

Step 2
--------
- get tomcat-connectors from:
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4/src/jakar
ta-tomcat-connectors-4.0.4-src.tar.gz

- extract into ${conn_dir}

- Set up build.properties
-- cd ${conn_dir}/jk
-- cp build.properties.sample build.properties
-- vi build.properties
-- set tomcat40.home
-- comment out tomcat41.home and tomcat33.home
-- comment out everything except apache2.home in the webservers location
section
-- set debug=false, optimize=true, profile=false in compile-time options
section
-- add 'linux=true' as the last line of build.properties

- Set up build.xml
-- vi build.xml
-- go to the native target section and change it to
    <target name="native" depends="jkant,detect,report" >
 <ant  dir="native" antfile="build.xml" target="apache20"  />
 <ant  dir="native2" antfile="build.xml" target="apache20"  />
    </target>

- Build
-- ant native

This builds up both mod_jk.so and mod_jk2.so under
${conn_dir}/jk/build/jk/apache2 and ${conn_dir}/jk/build/jk2/apache2

Step 3
--------
Get Apache-2.0.39/mod_jk.so to work with Tomcat 4.0.x and 4.1.x with the .so
built above

- Put the following workers.properties in /opt/apache2/conf

# Sample workers.properties
worker.list=ajp13

# Definition for Ajp13 worker
#
worker.ajp13.port=8009
# worker.ajp13.host=localhost
worker.ajp13.host=192.168.0.1
worker.ajp13.type=ajp13


- Put the following lines at the end of your httpd.conf

LoadModule jk_module modules/mod_jk.so
# AddModule mod_jk.c

JkWorkersFile "/opt/apache2/conf/workers.properties"
JkLogFile "/opt/apache2/logs/mod_jk.log"
JkLogLevel info

JkMount /*.jsp ajp13
JkMount /*.do ajp13
JkMount /servlet/* ajp13
JkMount /manager/* ajp13

- Start either Tomcat 4.0.x or 4.1.x on the machine which workers.properties
is pointing to (make sure that the AJP13 connector on port 8009 is
uncommented in server.xml), and try:
http://apache2.host/examples/jsp/num/numguess.jsp

- It should work!

Cheers,
- Lalit


----- Original Message -----
From: "Daniel Farinha" <da...@neuron.co.uk>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>
Sent: Saturday, July 06, 2002 10:11 PM
Subject: RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed
attempt


> Of course!
>
> I did read somewhere that you can use mod_jk, but I must admit after so
> many frustrating hours trying to make mod_jk2 work I forgot about that
> and was just about to go back to Apache 1.3.
> Thank you for reminding me, I have now linked tomcat4 and apache2 with
> mod_jk.
>
> Still, in order to compile mod_jk from the connectors-4.0.4 source I had
> first to compile the coyote code, and therefore hack the source as I
> mentioned in my original post. This didn't happen with connectors-4.0.2.
> A bit of a nuisance...
>
> Anyway, with this working my next task is to get it working with tomcat
> and apache on separate boxes. More hours of frustration I bet ;)
> I could hardly find any documentation regarding this kind of setup, can
> anyone offer any useful pointers?
>
> Andrew, thanks again for the tip.
>
> Dan




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed attempt

Posted by Andrew Conrad <an...@msn.com>.
I recommend lots of Mountain Dew and pizza for any kind of install of
Tomcat.  A little music never hurts either.

:)

-Andrew

-----Original Message-----
From: Daniel Farinha [mailto:daniel.farinha@neuron.co.uk] 
Sent: Saturday, July 06, 2002 10:11 PM
To: 'Tomcat Users List'
Subject: RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed
attempt


Of course!

I did read somewhere that you can use mod_jk, but I must admit after so
many frustrating hours trying to make mod_jk2 work I forgot about that
and was just about to go back to Apache 1.3. Thank you for reminding me,
I have now linked tomcat4 and apache2 with mod_jk.

Still, in order to compile mod_jk from the connectors-4.0.4 source I had
first to compile the coyote code, and therefore hack the source as I
mentioned in my original post. This didn't happen with connectors-4.0.2.
A bit of a nuisance...

Anyway, with this working my next task is to get it working with tomcat
and apache on separate boxes. More hours of frustration I bet ;) I could
hardly find any documentation regarding this kind of setup, can anyone
offer any useful pointers?

Andrew, thanks again for the tip.

Dan

> -----Original Message-----
> From: Andrew Conrad [mailto:andrewconrad@msn.com]
> Sent: 07 July 2002 00:00
> To: 'Tomcat Users List'; daniel.farinha@neuron.co.uk
> Subject: RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): 
> a failed attempt
> 
> 
> You know that you could use mod_jk with Apache 2, correct?
> 
> - Andrew


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Apache2-Tomcat4 over port 21

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
But I am using tomcat 3.3.1 and there is no default web.xml file in
$TOMCAT_HOME ?

kapil

-----Original Message-----
From: Daniel Farinha [mailto:daniel.farinha@neuron.co.uk] 
Sent: 07 July 2002 05:55
To: 'Tomcat Users List'
Subject: Apache2-Tomcat4 over port 21


I've configured Virtual Hosts as you describe under apache1.3/tc2.3 as
well, and they did work ok (i.e. no crossing of context), but haven't
gone around doing it with apache2/tc4 yet. If I do crack it I'll let you
know.

My problem now is to make apache2 in one box speak with tomcat4 in
another box, with the added difficulty that the tomcat box can only
'listen' on port 21 (with the problem of it being < 1024), because of a
firewall which separates the 2 boxes (messy, I know).

I added the following rule to ipchains in the tomcat side:
-A input -j REDIRECT 8009 -p tcp -s 0.0.0.0/0 -d 0.0.0.0/0 21

which basically forwards incoming requests from port 21 to port 8009 on
the local machine where the ajp13 connector is listening). I tested the
rule by making a test apache server (on the tomcat box) listen to 8009
and accessing it from a remote machine (ie. lynx
hostaddress:21) and it does work.
But when trying the Apache-Tomcat link it doesn't work (I get a 404 not
found)

My server.xml has:

<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
               port="8009" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>

My workers.properties has the port number configured:
worker.ajp13.port=21

If I could use a port > 1024 I'd have no problem, but I'm stuck with 21
for next 3 months.

Any tips on how to make Apache2 speak with AJP13 over port 21 would be
greatly appreciated.

Dan

> -----Original Message-----
> From: Luminous Heart [mailto:luminousheart@yahoo.com]
> Sent: 07 July 2002 04:02
> To: Tomcat Users List; daniel.farinha@neuron.co.uk
> Subject: RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): 
> a failed attempt
> 
> 
> If you are able to get tomcat4 + apache2 to work with
> VirtualHosts; i.e domain2.com/app1 domain1.com/app2 but not 
> domain2.com/app2 domain1.com/app1. If this seperation of 
> VirtualHosts and Contexts worked for you, please ##PLEASE## 
> let me know how you did it. 
> 
> I upgraded from apache1.3+tc2.3 where my virtualhosts
> and contexts did not cross. Now I can not get any
> virtual host or context/application to stay in its
> pin. I have posted three messages on this board with
> this regard, but it seems either noone has ran into a
> problem or no one has done similar work.
> 
> So, again, if you are going that path let me know.
> 
> Regards.


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Apache2-Tomcat4 over port 21

Posted by Daniel Farinha <da...@neuron.co.uk>.
I've configured Virtual Hosts as you describe under apache1.3/tc2.3 as
well, and they did work ok (i.e. no crossing of context), but haven't
gone around doing it with apache2/tc4 yet.
If I do crack it I'll let you know.

My problem now is to make apache2 in one box speak with tomcat4 in
another box, with the added difficulty that the tomcat box can only
'listen' on port 21 (with the problem of it being < 1024), because of a
firewall which separates the 2 boxes (messy, I know).

I added the following rule to ipchains in the tomcat side:
-A input -j REDIRECT 8009 -p tcp -s 0.0.0.0/0 -d 0.0.0.0/0 21

which basically forwards incoming requests from port 21 to port 8009 on
the local machine where the ajp13 connector is listening).
I tested the rule by making a test apache server (on the tomcat box)
listen to 8009 and accessing it from a remote machine (ie. lynx
hostaddress:21) and it does work.
But when trying the Apache-Tomcat link it doesn't work (I get a 404 not
found)

My server.xml has:

<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
               port="8009" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>

My workers.properties has the port number configured:
worker.ajp13.port=21

If I could use a port > 1024 I'd have no problem, but I'm stuck with 21
for next 3 months.

Any tips on how to make Apache2 speak with AJP13 over port 21 would be
greatly appreciated.

Dan

> -----Original Message-----
> From: Luminous Heart [mailto:luminousheart@yahoo.com] 
> Sent: 07 July 2002 04:02
> To: Tomcat Users List; daniel.farinha@neuron.co.uk
> Subject: RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): 
> a failed attempt
> 
> 
> If you are able to get tomcat4 + apache2 to work with 
> VirtualHosts; i.e domain2.com/app1 domain1.com/app2 but not 
> domain2.com/app2 domain1.com/app1. If this seperation of 
> VirtualHosts and Contexts worked for you, please ##PLEASE## 
> let me know how you did it. 
> 
> I upgraded from apache1.3+tc2.3 where my virtualhosts
> and contexts did not cross. Now I can not get any
> virtual host or context/application to stay in its
> pin. I have posted three messages on this board with
> this regard, but it seems either noone has ran into a
> problem or no one has done similar work.
> 
> So, again, if you are going that path let me know.
> 
> Regards.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed attempt

Posted by Luminous Heart <lu...@yahoo.com>.
If you are able to get tomcat4 + apache2 to work with
VirtualHosts; i.e domain2.com/app1 domain1.com/app2
but not domain2.com/app2 domain1.com/app1. If this
seperation of VirtualHosts and Contexts worked for
you, please ##PLEASE## let me know how you did it. 

I upgraded from apache1.3+tc2.3 where my virtualhosts
and contexts did not cross. Now I can not get any
virtual host or context/application to stay in its
pin. I have posted three messages on this board with
this regard, but it seems either noone has ran into a
problem or no one has done similar work.

So, again, if you are going that path let me know.

Regards.

--- Daniel Farinha <da...@neuron.co.uk>
wrote:
> Of course!
> 
> I did read somewhere that you can use mod_jk, but I
> must admit after so
> many frustrating hours trying to make mod_jk2 work I
> forgot about that
> and was just about to go back to Apache 1.3.
> Thank you for reminding me, I have now linked
> tomcat4 and apache2 with
> mod_jk.
> 
> Still, in order to compile mod_jk from the
> connectors-4.0.4 source I had
> first to compile the coyote code, and therefore hack
> the source as I
> mentioned in my original post. This didn't happen
> with connectors-4.0.2.
> A bit of a nuisance...
> 
> Anyway, with this working my next task is to get it
> working with tomcat
> and apache on separate boxes. More hours of
> frustration I bet ;)
> I could hardly find any documentation regarding this
> kind of setup, can
> anyone offer any useful pointers?
> 
> Andrew, thanks again for the tip.
> 
> Dan
> 
> > -----Original Message-----
> > From: Andrew Conrad [mailto:andrewconrad@msn.com] 
> > Sent: 07 July 2002 00:00
> > To: 'Tomcat Users List';
> daniel.farinha@neuron.co.uk
> > Subject: RE: tomcat_4.0.4 + apache_2.0.39 +
> mod_jk2 (linux): 
> > a failed attempt
> > 
> > 
> > You know that you could use mod_jk with Apache 2,
> correct?
> > 
> > - Andrew
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed attempt

Posted by Daniel Farinha <da...@neuron.co.uk>.
Of course!

I did read somewhere that you can use mod_jk, but I must admit after so
many frustrating hours trying to make mod_jk2 work I forgot about that
and was just about to go back to Apache 1.3.
Thank you for reminding me, I have now linked tomcat4 and apache2 with
mod_jk.

Still, in order to compile mod_jk from the connectors-4.0.4 source I had
first to compile the coyote code, and therefore hack the source as I
mentioned in my original post. This didn't happen with connectors-4.0.2.
A bit of a nuisance...

Anyway, with this working my next task is to get it working with tomcat
and apache on separate boxes. More hours of frustration I bet ;)
I could hardly find any documentation regarding this kind of setup, can
anyone offer any useful pointers?

Andrew, thanks again for the tip.

Dan

> -----Original Message-----
> From: Andrew Conrad [mailto:andrewconrad@msn.com] 
> Sent: 07 July 2002 00:00
> To: 'Tomcat Users List'; daniel.farinha@neuron.co.uk
> Subject: RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): 
> a failed attempt
> 
> 
> You know that you could use mod_jk with Apache 2, correct?
> 
> - Andrew


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed attempt

Posted by Andrew Conrad <an...@msn.com>.
You know that you could use mod_jk with Apache 2, correct?

- Andrew

-----Original Message-----
From: Daniel Farinha [mailto:daniel.farinha@neuron.co.uk] 
Sent: Saturday, July 06, 2002 5:47 PM
To: tomcat-user@jakarta.apache.org
Cc: daniel.farinha@neuron.co.uk
Subject: tomcat_4.0.4 + apache_2.0.39 + mod_jk2 (linux): a failed
attempt


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:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>