You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "O'Neill, John" <Jo...@ScottForesman.com> on 2003/04/15 22:56:49 UTC

Apache 2.0.43, Tomcat 4.1.18 and mod_jk2 problems

We have recently tried to move to the mod_jk2.so and have problems getting
it configured correctly.  I tried to use the some documentation provided in
JBoss, but have not gotten there yet.

We've created a new jk2.properties and worker2.properties, changed
httpd.conf LoadModule to load mod_jk2.so.  I'm including the files below.
Does anyone have a clue?  Is anyone using mod_jk2?

Thanks,
John

#--- workers2.properties

# Shared memory handling. Needs to be set.
[shm]
file=/u/web/apache/apache20/logs/shm.file
size=1048576

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

# Example UNIX domain socket
[channel.un:/u/web/tomcat/tomcat4118/work/jk2.socket]
tomcatId=myip:8009
#tomcatId=localhost:8009
debug=0

# define the worker
#[ajp13:localhost:8009]
[ajp13:myip:8009]
channel=channel.un:/u/web/tomcat/tomcat4118/work/jk2.socket
# To use the TCP/IP socket instead, just comment out the above
# line, and uncomment the one below
#channel=channel.socket:localhost:8009

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

# Uri mapping
[uri:/examples/*]
#worker=ajp13:localhost:8009
worker=ajp13:/u/web/tomcat/tomcat4118/work/jk2.socket

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

#---- end of workers2.properties

#---- begin jk2.properties

# list of needed handlers.
#handler.list=apr,channelSocket,channelUnix,request
handler.list=channelSocket,channelUnix,request

# Set the default port for the channelSocket
channelSocket.port=8009

# State where the UNIX domain socket is located
channelUnix.file=/u/web/tomcat/tomcat4118/work/jk2.socket

# Dynamic library
serverRoot=/u/web/apache/apache2
#apr.NativeSo=/usr/local/tomcat/lib/libjkjni.so

#---- end of jk2.properties


****************************************************************************
This email may contain confidential material.
If you were not an intended recipient, 
please notify the sender and delete all copies.
We may monitor email to and from our network.

****************************************************************************



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Apache 2.0.43, Tomcat 4.1.18 and mod_jk2 problems

Posted by Kevin Williams <kw...@tarity.com>.
John and any other mod_jk2 installation people having issues,

Maybe these instructions will help.  After HOURS of frustration, I
documented (and reproduced on another machine) the EXACT steps to
install and configure apache, tomcat, and mod_jk2 (all documents I found
covered parts of these three steps but never all).  Obviously additional
configurations need to be made to make the situation production quality,
but it gets everything integrated and running together!

If anyone has comments about these steps, please let me know.

Thanks,

Kevin Williams

Steps to combine apache and tomcat:

Overview:
I decided to use mod_jk2 since there were no binaries of either mod_jk
or
mod_jk2.so that worked for me, and mod_jk2 is supposed to replace
mod_jk.  Through trial and error, an
advantage that mod_jk has over mod_jk2 is the auto configure option. 
mod_jk2 does NOT 
have this option.

The default RPM Apache install from Redhat does NOT work!  Something to
do w/ the wrong 
version of the mod_jk2.c file.  Instead use the latest source download. 
I used 2.0.45.

Steps to install apache.
1.  Download the apache source file.  I used the latest (v.2.0.45). 
This can be found
at http://www.apache.org
2.  Extract the file to wherever you want.
3.  Navigate into the {install_root_folder}
4.  execute: ./configure --enable-mods-shared=all
5.  execute:  make
6.  execute:  make install
7.  To start, execute: PREFIX/bin/apachectl start (to stop
PREFIX/bin/apachectl stop)
9.  Make any custom changes required in the httpd.conf file
8.  verify it runs

Steps to install tomcat4:
1.  Download the tomcat4 RPM.  I used the latest (v4.1.18).  This can be
found at
http://jakarta.apache.org
2.  log in as root and run the rpm (rpm -xvf {file})
3.  This will add tomcat as a service, start the service
4.  Make any custom changes required in the server.xml file
5.  Add your application
4.  Type in http://www.localhost:8080/app_name to make sure it works

Steps to create mod_jk2.so:
1.  Download the mod_jk2 source file.  I used the latest at the time
(which was v.2.0.2).
I found it at
http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.2/src/.
2.  extract the file to wherever you want.
3.  find the apxs file on your computer.  For me, it was in
/usr/local/apache2/bin
4.  navigate to
{install_root_folder}/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2
5.  execute:  ./buildconf.sh
6.  execute:  ./configure --with-apxs2=/usr/local/apache2/bin/apxs
--with-apache2-lib=/usr/local/apache2/lib --with-tomcat41=/var/tomcat4
7.  execute:  make (the mod_jk2.so is now created)
8.  move to the
{install_root_folder}/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2.
9.  Verify the mod_jk2.so and jkjni.so files are created.
10.  Copy these file to your appache modules install folder.  For me, it
is
/usr/local/apache2/modules

Steps to integrate mod_jk2.so w/ Tomcat and Apache:
1.  Add the following line into httpd.conf file:
LoadModule jk2_module modules/mod_jk2.so

2.  create a workers2.properties file in the same conf folder as
httpd.conf.  This file should
contain something like (this file configures apache to work with jk2):
#jk2 config

[shm]
file=/usr/local/apache2/logs.shm.file
size=1048576

# Define the communication channel
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

#define worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

# Map the dev webapp to the Web server uri space
[uri:/dev/*]
info=Map the whole webapp
worker=ajp13:localhost:8009

3.  navigate to tomcat's conf directory.  For me, it is /etc/tomcat4
4.  if there is no jk directory, create it.
5.  navigate into the jk directory
6.  Create/Edit the jk2.properties file.  It should contain something
similar to the following:

# added by kevin--this is the tomcat portion of jk2.  the channelsocket
uses tcp/ip
#(unixSocket is available as well)
handler.list=apr,channelSocket,request
channelSocket.port=8009
apr.NativeSo=/usr/local/apache2/modules/jkjni.so

7.  Edit the server.xml file in tomcat's configuration directory.  The
default install
	had the mod_jk2 connector uncommented, and the mod_jk commented out. 
Make sure
	the mod_jk2 connector is active.  It should be the only connector
listening on port 8009.
	It looks like:

		    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
				<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="0"
               useURIValidationHack="false"
              
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

8.  Restart Tomcat
9.  Restart Apache
10.  enter your app's name w/ the tomcat standalone port of 8080 (make
sure it works)
11.  remove the 8080 and see if the apache to tomcat forwarding works.
12.  If desired remove the Connector that listens to port 8080 from
tomcat's server.xml file.







On Tue, 2003-04-15 at 13:56, O'Neill, John wrote:
> We have recently tried to move to the mod_jk2.so and have problems getting
> it configured correctly.  I tried to use the some documentation provided in
> JBoss, but have not gotten there yet.
> 
> We've created a new jk2.properties and worker2.properties, changed
> httpd.conf LoadModule to load mod_jk2.so.  I'm including the files below.
> Does anyone have a clue?  Is anyone using mod_jk2?
> 
> Thanks,
> John
> 
> #--- workers2.properties
> 
> # Shared memory handling. Needs to be set.
> [shm]
> file=/u/web/apache/apache20/logs/shm.file
> size=1048576
> 
> # Example socket channel, explicitly set port and host.
> [channel.socket:myip:8009]
> #[channel.socket:localhost:8009]
> port=8009
> host=myip
> 
> # Example UNIX domain socket
> [channel.un:/u/web/tomcat/tomcat4118/work/jk2.socket]
> tomcatId=myip:8009
> #tomcatId=localhost:8009
> debug=0
> 
> # define the worker
> #[ajp13:localhost:8009]
> [ajp13:myip:8009]
> channel=channel.un:/u/web/tomcat/tomcat4118/work/jk2.socket
> # To use the TCP/IP socket instead, just comment out the above
> # line, and uncomment the one below
> #channel=channel.socket:localhost:8009
> 
> # Announce a "status" worker
> [status:status]
> 
> # Uri mapping
> [uri:/examples/*]
> #worker=ajp13:localhost:8009
> worker=ajp13:/u/web/tomcat/tomcat4118/work/jk2.socket
> 
> [uri:/status/*]
> worker=status:status
> 
> #---- end of workers2.properties
> 
> #---- begin jk2.properties
> 
> # list of needed handlers.
> #handler.list=apr,channelSocket,channelUnix,request
> handler.list=channelSocket,channelUnix,request
> 
> # Set the default port for the channelSocket
> channelSocket.port=8009
> 
> # State where the UNIX domain socket is located
> channelUnix.file=/u/web/tomcat/tomcat4118/work/jk2.socket
> 
> # Dynamic library
> serverRoot=/u/web/apache/apache2
> #apr.NativeSo=/usr/local/tomcat/lib/libjkjni.so
> 
> #---- end of jk2.properties
> 
> 
> ****************************************************************************
> This email may contain confidential material.
> If you were not an intended recipient, 
> please notify the sender and delete all copies.
> We may monitor email to and from our network.
> 
> ****************************************************************************
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org