Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Tomcat 5, Apache2 and mod_jk2 integration problem

Paul Rathbone

2004-01-09


Hi

I am running RedHat 9 with Tomcat 5.0.16 and Apache 2.0.48 and trying to
get mod_jk2 to work so that I can use apache as the server and just pass
jsp and servlet requests on to tomcat.

In order to get tomcat to auto-generate the apache configuration files I
have had to take tomcat-jk2.jar from the most recent nightly build (to get
ApacheConfig.class) - see bugzilla bug report 25838 and its resolution.

I eventually managed to get mod_jk2 to compile (using configure, make etc
- not ant) and put mod_jk2.so and jkjni.so into apache/modules directory
(and added the LoadModule to httpd.conf).

Below I have pasted in my server.xml, workers2.properties and
jk2.properties files which at least get apache and tomcat to both start
without errors.

My problem is that when I try to open /jsp-examples/ through apache, I get
the following message in the browser : "The servlet container is temporary
unavailable or being upgraded" along with an Internal Error (500), and in
the catalina.out file I get :

Jan 9, 2004 1:53:58 PM
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
SEVERE: Caught exception (java.lang.NoSuchMethodError:
org.apache.coyote.Request.localName()Lorg/apache/tomcat/util/buf/MessageBytes;)
executing org.apache.jk.common.SocketConnection@(protected)
thread

in the apache error_log file is the following :

[Fri Jan 09 13:53:58 2004] [error] msgAjp.receive(): Bad signature 00
[Fri Jan 09 13:53:58 2004] [error] channelSocket.receive(): Bad header
[Fri Jan 09 13:53:58 2004] [error] workerEnv.processCallbacks() Error
reading reply
[Fri Jan 09 13:53:58 2004] [error] ajp13.service() ajpGetReply recoverable
error 120000

I have turned on as much logging as I can find and the jk2.log from
mod_jk2 doesn't log anything after it has started up.

However, I still have tomcat listening on port 8080 and the /jsp-examples/
works fine through there.

>From the contents of the log files I think mod_jk2 is working OK and
passing the request on to Tomcat, but tomcat is failing to process the
request - have I missed a step somewhere ?

I have experimented with [uri: ...] entries in workers2.properties and
with the <Context > tag in server.xml but haven't succeeded yet - can
anyone help please ?

Thanks for your time.

Paul

(Config files all with their comments removed)

jk2.properties :

shm.file=/usr/local/jakarta-tomcat-5/work/jk2.shm

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

workers2.properties :

[shm]
file=/usr/local/jakarta-tomcat-5/work/jk2.shm
size=1048576

[channel.socket:localhost:8009]
tomcatId=localhost:8009
info=Ajp13 forwarding over socket

[uri:/jsp-examples/*]

[logger.file:0]
level=DEBUG
file=/usr/local/apache/logs/jk2.log

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

server.xml

<Server port="8005" shutdown="SHUTDOWN" debug="0">
 <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener"
       debug="0"/>

<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
       forwardAll="false"
       noRoot="false"/>

<Listener className="org.apache.jk.config.ApacheConfig"
       modJk="/usr/local/apache/modules/mod_jk2.so"
       workersConfig="/usr/local/apache/conf/workers2.properties"/>

<GlobalNamingResources>
  <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
  <Resource name="UserDatabase" auth="Container"
        type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved">
  </Resource>
  <ResourceParams name="UserDatabase">
   <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
   </parameter>
   <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
   </parameter>
  </ResourceParams>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080"
         maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         debug="0" connectionTimeout="20000"
         disableUploadTimeout="true" />
  <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
         port="8009"
         enableLookups="false"
         redirectPort="8443"
         debug="0"
         protocol="AJP/1.3" />
  <Engine name="Catalina" defaultHost="localhost" debug="0">
   <Logger className="org.apache.catalina.logger.FileLogger"
        verbosity="4"
        prefix="catalina_log." suffix=".log"
        timestamp="true"/>
   <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
          debug="0" resourceName="UserDatabase"/>
   <Host name="localhost" debug="0" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">

    <Listener className="org.apache.jk.config.ApacheConfig"
           append="true"
           forwardAll="false"
           modJk="/usr/local/apache/modules/mod_jk2.so" />
    <Logger className="org.apache.catalina.logger.FileLogger"
          verbosity="4"
          directory="logs" prefix="localhost." suffix=".log"
       timestamp="true"/>
   </Host>
  </Engine>
</Service>
</Server>


-------------------------------------------------------------------------------
If you are not the intended recipient please notify the author by
replying to
this email.  Internet communications are not secure and therefore Red
Squared
plc does not accept legal responsibility for the contents of this
message.
Although we operate anti-virus programs, Red Squared does not accept
responsibility for any damage that may be caused by viruses being
passed.
Any views or opinions presented are solely those of the author and do not
necessarily represent those of Red Squared.
©2008 junlu.com - Jax Systems, LLC, U.S.A.