tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Tomcat Connector to Apache 2.2
Date Sun, 02 May 2010 10:14:47 GMT
Jie Sheng Chua wrote:
> Hi,
> 
> I operating Ubuntu 10.04 with Tomcat 6.0.24 on OpenJDK 6b18-1.8.
> I trying to configure tomcat connector to allow (for now) all request to be
> pass from Apache 2.2 to Tomcat 6.
> I downloaded mod_jk-1.2.28-httpd-2.2.X.so<http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.28/x86_64/mod_jk-1.2.28-httpd-2.2.X.so>
> .
> With the help of the quick start
> guide<http://tomcat.apache.org/connectors-doc/generic_howto/quick.html>,
> i manage to configure my workers.properties, httpd.conf and tomcat
> server.xml as follows.
> 
> After the below configuration, the connector didn't work. There are no error
> display on the logs too.

Can you define "didn't work" ?


> Example context from tomcat is the tomcat supplied examples.
> 
> Does anyone know how to make this work out?
> 
> Thanks and Best Regards
> Jie Sheng
> 
> *workers.properties*
> *
> *
> *
> # Define 1 real worker using ajp13
> worker.list=tomcat1
> 
> # Set properties for worker1 (ajp13)
> worker.tomcat1.type=ajp13
> worker.tomcat1.host=localhost
> worker.tomcat1.port=8009
> *
> 

Looks fine.


> *httpd.conf*
> 
> # Load mod_jk module
> # Update this path to match your modules location
> LoadModule    jk_module  /usr/lib/apache2/modules/mod_jk.so
> 

Looks fine, if the module is there.  But otherwise I guess Apache would 
not start.


> # Declare the module for <IfModule directive> (remove this line on Apache
> 2.x)
> # AddModule     mod_jk.c
> 
> # Where to find workers.properties
> # Update this path to match your conf directory location (put
> workers.properties next to httpd.conf)
> JkWorkersFile /etc/apache2/workers.properties
> 
> # Where to put jk shared memory
> # Update this path to match your local state directory or logs directory
> JkShmFile     /var/log/apache2/mod_jk.shm
> 
> # Where to put jk logs
> # Update this path to match your logs directory location (put mod_jk.log
> next to access_log)
> JkLogFile     /var/log/apache2/mod_jk.log
> 
> # Set the jk log level [debug/error/info]
> JkLogLevel    info
> 
> # Select the timestamp log format
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> 
> # Send everything for context /examples to worker named worker1 (ajp13)
> JkMount  /examples/* tomcat1
> 

Note that the above will ONLY forward to the connector and Tomcat, 
requests for URLs which match the above pattern, like
/examples/something.html
It will not forward the URL
/examples
For that, you would need a second JkMount
JkMount  /examples  tomcat1

Also see note (1) below.

> *tomcat server.xml*
> *
> *
> *
> <?xml version='1.0' encoding='utf-8'?>
> <Server port="8005" shutdown="SHUTDOWN">
>   <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on" />
>   <Listener className="org.apache.catalina.core.JasperListener" />
>   <Listener
> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
>   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
> />
>   <Listener
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

I believe your problem is here :

>   <Listener className="org.apache.jk.config.ApacheConfig"
> modJk="/usr/lib/apache2/modules/mod_jk.so" />
> 

Remove the above and try again.

I believe that you tried to mix two different techniques :
- trying to use the "Tomcat auto-configure" feature of mod_jk
and
- configuring mod_jk yourself

I think that the two do not play well together.
And anyway :
- I am not sure that the auto-configure feature still works
- the documentation also says that it is specific to Tomcat 5.x


>   <GlobalNamingResources>
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
>               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
>   </GlobalNamingResources>
> 
>   <Service name="Catalina">
>     <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
>         maxThreads="150" minSpareThreads="4"/>
>     <Connector port="8080" protocol="HTTP/1.1"
>                connectionTimeout="20000"
>                URIEncoding="UTF-8"
>                redirectPort="8443" />


>     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

The above is OK, leave it.


>     <Engine name="Catalina" defaultHost="localhost">
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>       <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false">
>       </Host>
>     </Engine>
>   </Service>
> </Server>
> 
> *
> 


Note (1) :
As an alternative to the JkMount/JkUnMount directives, there also exists 
the following (in the Apache httpd.conf) :

<Location /examples>
   SetHandler jakarta-servlet
   ...

</Location>

(You can also use <LocationMatch> instead of <Location>)

This is described here :
http://tomcat.apache.org/connectors-doc/reference/apache.html
, at the very end of the page, in the section "Using SetHandler and 
Environment Variables".
Using this or the JkMount/JkUnMount syntax is a question of personal 
preference. I prefer this second form, because I find that it matches 
the general Apache configuration style better.  It also makes it easier 
to add additional Apache directives to be applied to the URLs which you 
forward to Tomcat.



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


Mime
View raw message