1. Edit the file $JONAS_BASE/conf/server.xml; locate and uncomment
the
following line:
<!--Change it to look like the following:
<Connector port="9009"
enableLookups="false" redirectPort="9043" debug="0"
protocol="AJP/1.3" />
-->
<Connector port="9009"
enableLookups="false" redirectPort="9043" debug="0"
protocol="AJP/1.3" />
Replace the base Engine tag in which a jvmRoute with the standard engine is used.
...
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
port="9009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="9043"
acceptCount="10" debug="0" connectionTimeout="0"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
<Engine name="Tomcat-JOnAS-Engine" defaultHost="localhost" debug="0"
jvmRoute="jonas01">
and uncomment the following line: <Engine name="Tomcat-JOnAS-Engine" defaultHost="localhost" debug="0">
Note: Always backup files like server.xml before editing.
<Listener className="org.apache.jk.config.ApacheConfig"
modJk="$APACHE_HOME/modules/mod_jk.so" />
<Listener className="org.apache.jk.config.ApacheConfig"When jonas/tomcat is restarted, there will be a file created under
append="true" forwardAll="false"
modJk="$APACHE_HOME/modules/mod_jk.so"/>
# Load the mod_jk module if not loaded.
<IfModule !mod_jk.c>
LoadModule jk_module "$APACHE_HOME/modules/mod_jk.so"
</IfModule>
# Specify location of worker file and log file. Worker file will follow shortly.
JkWorkersFile "$JONAS_BASE/conf/jk/workers.properties"
JkLogFile "$JONAS_BASE/logs/mod_jk.log"
# When and how much logging.
JkLogLevel emerg
# This is a little awkward. It seems mod_jk associates applications it will
# map to tomcat based on the virtual host. If for instance I wish to visit
# the jonasAdmin application through http://jonas-server/jonasAdmin from another
# machine and I have the following setting then the application behaves
# perfectly normally, i.e, behaves as one would expect if you
# were using the application directly using the appropriate port (9000).
# However, if you try using http://localhost/jonasAdmin from jonas-server
# without the explicit VirtualHost declaration, only the directory contents
# are mapped. No processing on the tomcat is carried out, so struts based
# applications will fail to work. That is the reason why we explicitly
# mention both virtual hosts.
<VirtualHost jonas-server>
ServerName jonas-server
JkMount /cmp2 ajp13
JkMount /cmp2/* ajp13
JkMount /alarm ajp13
JkMount /alarm/* ajp1
JkMount /earsample ajp13
JkMount /earsample/* ajp13
JkMount /jonasAdmin ajp13
JkMount /jonasAdmin/* ajp13
</VirtualHost>
<VirtualHost localhost>
ServerName localhost
JkMount /cmp2 ajp13
JkMount /cmp2/* ajp13
JkMount /alarm ajp13
JkMount /alarm/* ajp13
JkMount /earsample ajp13
JkMount /earsample/* ajp13
JkMount /jonasAdmin ajp13
JkMount /jonasAdmin/* ajp13
</VirtualHost>
3. Now tell apache to use this file. Backup the file: $APACHE_HOME/conf/httpd.conf.
Include ${JONAS_BASE}/conf/jk/mod_jk.confNote: replace ${JONAS_BASE} with appropriate value.
LoadModule jk2_module modules/mod_jk2.so
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/java
#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/
#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#
#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
#
# Add 'inprocess' if you want JNI connector
worker.list=ajp13
# , inprocess
#
#------ DEFAULT worker1 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named worker1 and of type worker1
# Note that the name and the type do not have to match.
#
worker.ajp13.port=9009
worker.ajp13.host=jonas-server
worker.ajp13.type=ajp13
#----------------------------------------------------------