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

      Hi!!

      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.

      Bentzy.



        • 1. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
          jonlee
          • 2. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
            bentzy

            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?
              jonlee

              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

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

                [root@bentzylinuxpc jboss-3.0.4_tomcat-4.1.12]# find ./ -name jboss-service.xml
                ./server/all/conf/jboss-service.xml
                ./server/all/deploy/http-invoker.sar/META-INF/jboss-service.xml
                ./server/all/deploy/jmx-rmi-adaptor.sar/META-INF/jboss-service.xml
                ./server/default/conf/jboss-service.xml
                ./server/default/deploy/http-invoker.sar/META-INF/jboss-service.xml
                ./server/default/deploy/jmx-rmi-adaptor.sar/META-INF/jboss-service.xml
                ./server/default/tmp/deploy/server/default/conf/jboss-service.xml
                ./server/minimal/conf/jboss-service.xml

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

                Any ideas?
                THANX!!

                • 5. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
                  jonlee

                  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

                    Jon!
                    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 ...

                    WHY??

                    and with 3.2,

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

                    THANX!!

                    • 7. Re: Apache JBoss 3.2.1-Tomcat 4.1.24 HOWTO?
                      bentzy

                      I just attached my output .
                      Please help and Thanks!

                      • 8. Configuring your embedded Tomcat/Jetty for AJP13/JK2
                        jonlee

                        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 -->
                        <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->



                        <!---->

                        10
                        100
                        30000
                        <!--5000-->
                        8443





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



                        <!---->
                        8443
                        5
                        100
                        30000
                        2000
                        /conf/tomcat.key
                        changeit
                        changeit





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



                        8009
                        5
                        20
                        0
                        443




                        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
                          jonlee

                          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.
                          http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/

                          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
                          e

                          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):
                          make

                          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
                            jonlee

                            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:

                            [logger]
                            level=DEBUG

                            [config:]
                            file=${serverRoot}/conf/workers2.properties
                            debug=0
                            debugEnv=0

                            [uriMap:]
                            info=Maps the requests. Options: debug
                            debug=0

                            # Define the communication channel
                            [channel.socket:172.16.32.26:8009]
                            info=Ajp13 forwarding over socket
                            tomcatId=172.16.32.26:8009

                            # Map the Tomcat examples webapp to the web server uri space
                            [uri:/test1/*]
                            info=Map the whole webapp

                            [shm:]
                            info=Scoreboard. Required for reconfiguration and status with multiprocess servers
                            file=${serverRoot}/logs/jk2.shm
                            size=1000000
                            debug=0
                            disabled=0

                            Note that I'm connecting via a socket to the JBoss/Tomcat or JBoss/Jetty AJP13 service located at the address 172.16.32.26 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:
                            http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.0/doc/jk2/configwebcom.html

                            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
                              mtb2ride

                              jon,

                              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.

                              Thanks,
                              Steve

                              • 12. Re: Configuring and running mod_jk2 in Apache 2.0
                                jonlee

                                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:
                                }
                                protocolHandler.setAdapter(adapter);

                                - 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",
                                System.getProperty("catalina.base"));
                                -
                                + }
                                // 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
                                  jonlee

                                  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?
                                    mikelarnett

                                    jonlee,
                                    Thanks for this great HOWTO. It got me up and running in no time.
                                    Thanks,
                                    -MLA

                                    1 2 Previous Next