11 Replies Latest reply on May 23, 2003 2:51 PM by amoldc

    (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jakarta

    alexspetty

       

      "alexspetty" wrote:
      "alexspetty" wrote:
      Fellow JBossonians:

      I thought it was time to update my "how-to" guide from december 2002.

      This guide walks you through setting up:
      (Apache 2.0.45) --- ajp13 via mod_jk2 ---> (JBoss 3.2.1 and Jakarta-Tomcat 4.1.24)

      I hope you find this helpful.

      Warm Regards,

      Alexander Petty
      The Jaxara Group
      www.jaxara.com



        • 1. Re: Configuring a container for POJOs
          amoldc

          So the container construction code is a bit hacky.

          I'm actually thinking that this config should be more long winded and more
          explicit but giving you more control.
          i.e. you construct the whole container using the metadata.

          In more detail, currently we have the implicit container when you configure an
          interceptor:

           <bean name="SimpleBean1"
           bean="org.jboss.test.SimpleBeanImpl">
           <interceptors>
           <interceptor bean="org.jboss.test.AnInterceptor">
           </interceptor>
           </interceptors>
           </bean>
          


          But how much better would it be if you had more control...

          <bean name="SimpleBean1"
           bean="org.jboss.proxy.Proxy">
           <attribute name="interfaces">org.jboss.test.SimpleBean</attribute>
           <attribute name="handler">
           <bean bean="org.jboss.container.bean.BeanContainer">
           <attribute name="Interceptors">
           <bean bean="org.jboss.test.AnInterceptor"/>
           <bean bean="org.jboss.test.AnotherInterceptor"/>
           </attribute>
           <attribute name="Target">
           <bean bean="org.jboss.test.SimpleBeanImpl"/>
           </attribute>
           </bean>
           </attribute>
          </bean>
          


          This is great for internal work where you could set an attribute on the Target
          at deployment time, but not have the attribute exposed to the user
          at runtime via the interface.

          Of course there would need to a simpler xml exposed to the users
          for the most common use cases which would "transform" into this more long winded
          but more flexible form for internal use or if the user wants more control.

          • 2. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
            camel

            Alexander,
            What is the URL? Thanks

            -chris

            • 3. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
              alexspetty

               

              "alexspetty" wrote:
              The file is attached to this post. Click the text file above. :)

              -Alex


              • 4. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
                ttobin852

                Any help for us unix folks?

                I have followed the directions, the modules install just fine, but jsp and servlets are not directed to the jboss container.

                Maybe just a little background will help me solve this myself.

                How does the config tell apache to forward jsp and servlets to port 8080. i just dont see any config for that aspect. I get that it is looking for /servlet and *.jsp but i just dont see how this makes the redirect happen. esp if you configure your jboss to listen on a diff port.

                a little help would be appreciated.

                • 5. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
                  mikefinn

                   

                  "mikefinn" wrote:
                  The jk/jk2 module forwards servlet/jsp traffic via the AJP protocol to port 8009 (by default). Look at the worker2.properties, specifically the worker definition (ajp:XXX:YYY), which specifies the channel, which tells JK where to send the request and how to send it (sockets).

                  The URI mapping will route jsp/servlet requests to the config'd worker instance.

                  I have a similar doc for Jetty, though it may be less relevant now that 4.0 default container is tomcat. If anyone thinks it would be of value, let me know.

                  HTH,
                  Mike


                  • 6. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak

                    Mike,

                    please attach it to this thread if possible.

                    • 7. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak

                      .... or actually make a new topic out of it, so it'll be easier to find

                      • 8. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
                        mikefinn

                        Will do - hopefully this week. It just needs some cleanup.
                        Mike

                        • 9. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
                          kapilesh_arekar

                          I am using Jboss 3.2.1 bundled with Tomcat 4.1.24.Its is on windows 2k platform.I have installed Apache 2.0.47. I followed the steps exactly as mentioned by your Jboss how to June 2003 .txt ,but no success .I have also included the required DLL and made necessary configurations in worker2.properties as well as httpd.conf.
                          In Jboss I have deployed a war file test.war which forms a context at localhost:8080/test/index.jsp.
                          What i want is when i type the address localhost/test/ it should redirect my request to Jboss Tomcat Container.But itis not doing that.Can you please guide me on this.I checked several times if I am going wrong in reading the txt file which you have attached.Any help will be extremely apprciated
                          Is there no configuration required in Jboss Side
                          Please elaborate on anything .I am a novice and need this urgently

                          • 10. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
                            ryanjoe

                            Do you still have a document for Apache 1.3.xx to JBoss ? If so could you post it on a URL ?
                            regards
                            Joe Ryan

                            • 11. Re: (Apache 2.0.45) - ajp13 via jk2 --> (JBoss 3.2.1 and Jak
                              anonymousbosch

                              ********************************************************************
                              * JBoss Basic Configuration Guide *
                              * June 2003 Edition *
                              * *
                              * >> How to configure Apache HTTP Server 2.0.45 to communicate *
                              * with JBoss 3.2.1's integrated Catalina 4.1.24 implementation *
                              * via AJP13 with MOD_JK2 << *
                              * *
                              * >> How to configure JBoss 3.2.1 with integrated Catalina 4.1.24 *
                              * as a "Windows Service" << *
                              * *
                              * Author: Alexander Petty of Warrenton, Virginia, USA *
                              * Date: 06/05/03 *
                              * Time: 12:30:00 EST *
                              * *
                              ********************************************************************
                              * by the way: *
                              * *
                              * if you require software development and/or application *
                              * integration consulting services, *
                              * my firm :: the jaxara group :: can help. *
                              * look us up at: www.jaxara.com *
                              * *
                              * if you like music, check out my music at www.drumfish.com *
                              * there you can listen to mp3's of all my records in their *
                              * entirety for free!! please help me get the word out about *
                              * drumfish (my band) and thanks! *
                              * *
                              * *
                              ********************************************************************

                              *******************************************************************************************************
                              ** Configuration Guide for Apache HTTPd/Tomcat AJP13 Connector configuration using the JK2 Connector **
                              *******************************************************************************************************

                              Assumed OS: Windows NT/2K/XP

                              Assumed Environment:

                              JAVA_HOME c:\lib\java
                              JBOSS_HOME c:\jboss
                              APACHE_HOME c:\apache2

                              <<< (How to set up the basic environment)
                              -- download and setup
                              Download JavaTM 2 Platform, Standard Edition, v 1.4.1_02 from
                              http://java.sun.com/j2se/1.4.1/download.html
                              run installer exe, change destination path to c:\lib\java
                              Download jboss-3.2.1_tomcat-4.1.24 from
                              http://prdownloads.sourceforge.net/jboss/jboss-3.2.1_tomcat-4.1.24.zip
                              decompress zip and copy to c:\jboss
                              Download Apache 2.0.45 from from
                              http://www.apache.org/dist/httpd/binaries/win32/apache_2.0.45-win32-x86-no_ssl.exe
                              run installer exe, change destination path to c:\, configure to run as a service on port 80

                              -- set your environment in control panel | system | advanced | environment variables | system variables
                              JAVA_HOME c:\lib\java
                              JBOSS_HOME c:\jboss
                              APACHE_HOME c:\apache2
                              >>>

                              1) acquire win32 binary of the jk2 connector module (mod_jk2-2.0.43.dll)

                              from http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.2/bin/win32/
                              copy to C:\apache2\modules

                              Note: although the connector's file name explicitly references apache version 2.0.43, it works
                              perfectly well with versions of apache higher than 2.0.43 (such as 2.0.45)

                              Also Note: if you are using apache 1.3.27 or higher you must use mod_jk2-1.3.27.dll


                              2) in the path: "c:\apache2\logs" create an empty file called: "shm.file"

                              3) add file C:\apache2\conf\workers2.properties
                              add the entire file contents below

                              ---> start (do not cut this line to clipboard)

                              # BOF - workers2.properties
                              # $Date: 2003/06/05 12:30:00
                              # $Author: Alexander Petty
                              # $Application: (Apache 2.0.45) --ajp13--> (JBoss 3.2.1 and Jakarta-Tomcat 4.1.24)
                              #

                              # comment out for production server
                              # [logger.apache2]
                              # level=DEBUG

                              [shm]
                              file=c:/apache2/logs/shm.file
                              size=1048576

                              # Example socket channel, override port and host.
                              [channel.socket:localhost:8009]
                              port=8009
                              host=localhost

                              # define the worker
                              [ajp13:localhost:8009]
                              channel=channel.socket:localhost:8009

                              # Uri mapping
                              [uri:[your_machines_ip_address]/*.jsp]
                              worker=ajp13:localhost:8009

                              [uri:[your_machines_ip_address]/servlet/*]
                              worker=ajp13:localhost:8009

                              [uri:[your_machines_ip_address]/[desired_uri]/*]
                              worker=ajp13:localhost:8009

                              [uri:[your_machines_hostname]/*.jsp]
                              worker=ajp13:localhost:8009

                              [uri:[your_machines_hostname]/servlet/*]
                              worker=ajp13:localhost:8009

                              [uri:[your_machines_ip_hostname]/[desired_uri]/*]
                              worker=ajp13:localhost:8009

                              #
                              # EOF - workers2.properties

                              ---> end file (do not cut this line to clipboard)

                              2) edit the sections of this workers2.properties titled:

                              Uri mapping

                              Ensure that the bracketed variables [your_machines_ip_address],
                              [your_machines_hostname], and [desired_uri] are replaced with
                              information specific to your server.

                              newbies: completely exclude any lines with reference to [desired_uri] until
                              you understand how a desired_uri might benefit you.

                              Note: Any hostname/address that resolves to your server needs to be included here. JK2 will
                              not resolve any names dynamically, so if they are not listed in this file your
                              configuration will not properly handle servlet requests for the given name.

                              Also Note: Optional: If you are using virtual directories with apache you may use at the
                              bottom of the default virtualhost tag the tag parameters:

                              <Location "/*.jsp"> JkUriSet ajp13:localhost:8009
                              <Location "/servlet/*"> JkUriSet ajp13:localhost:8009

                              This configuration will allow you to comment/remove the entire "uri mapping"
                              section of workers2.properties and manage the uri mappings from http.conf

                              3) edit file C:\apache2\conf\httpd.conf
                              find the sction titled :

                              # Dynamic Shared Object (DSO) Support

                              add directly beneath it:

                              LoadModule jk2_module modules/mod_jk2-2.0.43.dll

                              4) restart apache httpd server and start jboss

                              5) open a browser and test http://[your_machines_hostname]
                              you should see apache test page

                              6) open a browser and test http://[your_machines_hostname]:8080
                              you should see tomcat error page indicating no configured context

                              7) open a browser and test http://[your_machines_hostname]/servlet/test.html
                              if you see tomcat error page indicating no configured context, apj13 connector is working properly

                              8) open a browser and test http://[your_machines_hostname]/test.jsp
                              if you see tomcat error page indicating no configured context, apj13 connector is working properly

                              9) if steps 7 and 8 did not show you the Tomcat no context error message, then redo all the above steps
                              this time read the steps more carefully!!!

                              ********************************************************************************************************
                              ** You have successfully completed the Apache HTTPd/Tomcat AJP13 Connector configuration successfully **
                              ********************************************************************************************************

                              Continue on to learn how to set up JBOSS an "Windows Service"

                              ********************************************************************************************************
                              ** Configuration Guide for running JBOSS 3.2.1 with integrated Catalina 4.1.24 as a "Windows Service" **
                              ********************************************************************************************************
                              Assumed OS: Windows NT/2K/XP

                              Assumed Environment:

                              JAVA_HOME c:\lib\java
                              JBOSS_HOME c:\jboss
                              APACHE_HOME c:\apache2

                              1) Download JavaService from
                              http://www.alexandriasc.com/software/JavaService/JavaService-bin-1.2.0.zip
                              decompress files and copy JavaService.exe to c:\jboss\bin

                              2) Create a file Called c:\jboss\bin\InstallJBossService.cmd
                              add the entire file contents below to newly created file and save


                              ---> start file (do not cut this line to clipboard)

                              @echo off
                              echo.
                              echo Installing JBoss as service on Windows NT/2K/XP
                              echo -----------------------------------------------
                              echo.

                              if [%1] == [] goto help
                              if [%2] == [] goto help
                              if [%Java_Home%] == [] goto help
                              if [%JBoss_Home%] == [] goto help

                              echo on
                              JavaService -install %1 %Java_Home%\jre\bin\server\jvm.dll -Djava.class.path=%Java_Home%\lib\tools.jar;%JBoss_Home%\bin\run.jar;%JBoss_Home%\bin\shutdown.jar -start org.jboss.Main -params -c %2 -stop org.jboss.Shutdown -out %JBoss_Home%\server\%2\log\stdout.log -err %JBoss_Home%\server\%2\log\stderr.log -current %JBoss_Home%\bin

                              @echo off
                              echo.
                              echo.
                              echo The JBoss service can be removed with "JavaService.exe -uninstall %1".
                              goto end

                              :help
                              echo The environment variables %%Java_Home%% and %%JBoss_Home%% have to be set,
                              echo JavaService.exe and this script have to be in %%JBoss_Home%%\bin.
                              echo.
                              echo Parameters:
                              echo %0 service-name configuration
                              echo.
                              echo service-name: name of service (e.g. "JBoss")
                              echo configuration: configuration of JBoss (e.g. "default", "all" or "minimal")
                              echo.
                              echo Java_Home = %Java_Home%
                              echo JBoss_Home = %JBoss_Home%
                              echo.

                              :end

                              ---> end file (do not cut this line to clipboard)

                              3) from the command line type the following:
                              1>> cd\
                              2>> cls
                              3>> cd c:\jboss\bin
                              4>> InstallJBossService "JBoss with Tomcat" default

                              4) make sure any manually started JBOSS servers are stopped

                              5) open up the services applet from the control panel and right click the newly added service,
                              JBoss with Tomcat, choose start to get it running and make sure it set to start automatically

                              ***************************************************************************************************
                              ** You have successfully completed the JBOSS as NT Service configuration successfully. **
                              ***************************************************************************************************