1 2 Previous Next 17 Replies Latest reply on Jan 17, 2004 12:50 AM by bear42ba

    Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?

    Bentzy Sagiv Newbie


      I have a well configurated workspace with Apache + JBoss3.0.4-Tomcat4.1.12 working properly on W2K.

      How can I connect to my Apache to the Tomcat bundled with JBoss 3.2.1????- and now, on LINUX.

      It is my question how to connect mod_jk2 to jbossweb-tomcat.sar?

      I will really really appreciate your help on this HOWTO issue.


        • 2. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
          Bentzy Sagiv Newbie

          There is not updated stuff for my issue at Alex's HOWTO very good stuff.

          Can I referre to "jbossweb-tomcat.sar" as CATALINA_HOME??

          • 3. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
            Jon Barnett Master

            I'm not sure I understand your issue but let me clarify the configuration.

            JBoss 3.2.x has a simplified configuration for both jbossweb-tomcat and jbossweb-jetty. The META-INF/jboss-service.xml in the respective SAR directories for both are almost word for word copies of the native configuration files for the servlet containers with respect to the connectors.

            If you look in that file, you will see that an AJP13 (JK2) connector is already set up for port 8009. If you are not going to be using the other connectors, you can comment them out. You can also change the AJP13 port if you like.

            Alex's HowTo is then applicable to the rest - which is a configuration guide for Apache and mod_JK2, which isn't particularly JBoss configuration related. The Apache Tomcat site covers the rest of the detail if you need it, on JK2.

            Hope that helps.

            • 4. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
              Bentzy Sagiv Newbie

              Looking for jboss-service.xml I found these files:

              [root@bentzylinuxpc jboss-3.0.4_tomcat-4.1.12]# find ./ -name jboss-service.xml

              but no of them includes the texts: jk, jk2, 8009, or AJP13 ?!

              Any ideas?

              • 5. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
                Jon Barnett Master

                You are looking at the 3.0.x distribution. 3.2.x has a more uniform configuration layout that conforms to the information I have given. Since you indicate that you have already configured a 3.0.x service, I have not given any configuration information regarding that. The Linux configuration for 3.0.x should be no different to your existing working 3.0.x installation. Use the free documentation on release 3.0.x from the documentation page of this web site as a guide to connector configuration for Tomcat.

                Otherwise, for a 3.2.x release, my instructions should work.

                Hope that helps.

                • 6. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
                  Bentzy Sagiv Newbie

                  First of all, thanks for the help!

                  My last post referres to JBoss 3.0 because I tryed it while 3.2 embarrased me.
                  It was my error.Sorry.

                  My status now is:

                  with 3.0, even I:

                  cd ${jtc.home}
                  cp jtc.jar ${catalina.home}/server/lib
                  cd ${jtc.home}/jk/build/lib
                  cp tomcat-jni.jar ${catalina.home}/bin
                  cd ${catalina.home}/server/lib
                  rm tomcat-ajp.jar tomcat-util.jar tomcat-coyote.jar tomcat-http11.jar

                  and edit the conf/server.xml :

                  when I ./run.sh I get a ClassNotFoundException:
                  org.apache.coyote.tomcat4.CoyoteConnector ...


                  and with 3.2,

                  WHERE have I to copy the jtc.xml and
                  the tomcat-jni.jar files???


                  • 7. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
                    Bentzy Sagiv Newbie

                    I just attached my output .
                    Please help and Thanks!

                    • 8. Configuring your embedded Tomcat/Jetty for AJP13/JK2
                      Jon Barnett Master

                      I would recommend that you switch to JBoss 3.2.x with Tomcat 4.1.24 or Jetty 4.2.9/10. I don't have a captive JBoss 3.0.x with Tomcat so I can only really guess with the configuration.

                      AJP13/JK2 is simple with JBoss 3.2.x/Jetty/Tomcat. You will not need JNI. Apache will not be starting an in-process servlet container - the container is under the control of JBoss. Similarly, jtc is not necessary with JK2.

                      There is nothing to be done on the servlet container side of things except configuring the socket listener. By default, these are enabled in the distribution. If you are using JK2, you may want to switch off the other standard HTTP/HTTPS listeners. The configuration files will be located in server/instance/deploy/jbossweb-jetty.sar/META-INF/jboss-service.xml and server/instance/deploy/jbossweb-tomcat.sar/META-INF/jboss-service.xml respectively for Jetty and Tomcat.

                      Jetty has the following:
                      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
                      <!-- Add and configure a HTTP listener to port 8080 -->
                      <!-- The default port can be changed using: java -Djetty.port=80 -->
                      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->



                      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
                      <!-- Add a HTTPS SSL listener on port 8843 -->
                      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


                      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
                      <!-- Add a AJP13 listener on port 8009 -->
                      <!-- This protocol can be used with mod_jk in apache, IIS etc. -->
                      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


                      Note the AJP13 port is defined to be 8009. Also note that the comment is incorrect - it is for mod_jk2 not mod_jk.

                      Tomcat has the following:
                      <!-- A HTTP/1.1 Connector on port 8080 -->

                      <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->

                      <!-- A AJP 1.3 Connector on port 8009 -->

                      Check your respective configuration and make sure you know where your AJP13 service is configured and the port to which it is bound.

                      If it is not commented out (it should not be in an out-of-the-box JBoss distribution), then you will have nothing to do for the JBoss side of the install. Just make sure JBoss is started.

                      • 9. Building and installing mod_jk2 for Linux Apache 2.0
                        Jon Barnett Master

                        This is probably the most frustrating part of the installation. The JK2 distribution is brain-dead, perplexing and in some cases just plain wrong. The information is sparse and requires you to hunt around until you untangle the issues. So here is a quick guide.

                        Get the source - there are no binaries.

                        Unpack the source in Linux.

                        Modify jk/native2/configure of the distribution as it tests for apache2 directory as a file! The changed fragment should be this:
                        if ${TEST} ! -d ${tempval}/; then
                        { { echo "$as_me:$LINENO: error: can't locate ${tempval}/" >&5

                        Originally, the test was ! -f.

                        We are only interested in building the plugin for Apache 2.0 - so just go to jk/native2 of the distribution and run the following:
                        ./configure --with-tomcat40=/usr/local/tomcat-4.1 --with-tomcat41=/usr/local/tomcat-4.1 --with-apache2=/usr/local/apache2 --with-apxs2=/usr/local/apache2/bin/apxs

                        Use appropriate values for your apache install and install a stand-alone copy of Tomcat 4.1 only for the purposes of the build finding the information it wants to build mod_jk2.so.

                        When configured, just run make from the same directory (jk/native2):

                        Copy the completed files *.so from the build directory of the source distribution. If you are still in the directory you performed the build (via make) and using the Apache install directory from my example, it would be:
                        cp ../build/jk2/apache2/mod*.so /usr/local/apache2/modules

                        Modify this for your requirements. Now, just run libtool as per the instructions from the build. Again from this case example:
                        libtool --finish /usr/local/apache2/modules

                        Apache now has mod_jni and mod_jk2 installed. Remember though that we don't want to run JNI!

                        • 10. Configuring and running mod_jk2 in Apache 2.0
                          Jon Barnett Master

                          With mod_jk2 installed, you now just need to configure conf/workers2.properties in your Apache 2.0 installation and local the module. The simplest installation consists of this:



                          info=Maps the requests. Options: debug

                          # Define the communication channel
                          info=Ajp13 forwarding over socket

                          # Map the Tomcat examples webapp to the web server uri space
                          info=Map the whole webapp

                          info=Scoreboard. Required for reconfiguration and status with multiprocess servers

                          Note that I'm connecting via a socket to the JBoss/Tomcat or JBoss/Jetty AJP13 service located at the address at port 8009. Change this to point to the location of your JBoss installation. There is expected to be a webapp context on Tomcat/Jetty at /test1. Map your URIs according to your requirements.

                          You can look up the meanings of the entries at:

                          There is also an example with the source distribution. It adds the JNI stuff, which is just going to confuse most people who don't want Apache to start and stop Tomcat in an in-process manner (which isn't going to particularly work well with a JBoss embedded web server).

                          Remember to add the LoadModule directive in your httpd.conf for Apache 2.0.

                          LoadModule jk2_module modules/mod_jk2.so

                          Make sure that your JBoss server is up and running. Restart Apache 2.0 and you should be able to get content from your servlet container.

                          e.g. http://apacheserver/test1

                          That is all that is required for connecting via AJP13.

                          • 11. Re: Configuring and running mod_jk2 in Apache 2.0
                            Steve Dodge Newbie


                            Great explanation on getting mod_jk2 up and running. I have a question on one thing though. Where do I specify the parameters that are usually set in jk2.properties ? Because I really don't see any place to put the jk2.properties file.


                            • 12. Re: Configuring and running mod_jk2 in Apache 2.0
                              Jon Barnett Master

                              Currently, jk2.properties for embedded Tomcat isn't well supported by the Tomcat Coyote Connector. A patch has been submitted to the Tomcat build but I don't know when that will be put in an official release. The patch for CoyoteConnector.java is:

                              - IntrospectionUtils.setProperty(protocolHandler, "jkHome",
                              + String jbosshome = System.getProperty("jboss.server.home.dir");
                              + if (jbosshome != null) {
                              + // set jkHome to jboss server home dir.
                              + // (ex. $JBOSS_HOME/server/default)
                              + IntrospectionUtils.setProperty(protocolHandler, "jkHome",
                              + jbosshome);
                              + } else {
                              + IntrospectionUtils.setProperty(protocolHandler, "jkHome",
                              + }
                              // Set attributes
                              IntrospectionUtils.setProperty(protocolHandler, "port", "" + port);
                              IntrospectionUtils.setProperty(protocolHandler, "maxThreads",

                              So you can patch it yourself with the current source code. That is, if you really need the jk2.properties.

                              • 13. Re: Configuring and running mod_jk2 in Apache 2.0
                                Jon Barnett Master

                                Forgot to add, if this wasn't apparent, that the jk2.properties will be looked for in JBOSS_HOME/server/{server-name}/conf/jk2.properties when you install this patch.

                                • 14. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
                                  Michael Arnett Newbie

                                  Thanks for this great HOWTO. It got me up and running in no time.

                                  1 2 Previous Next