14 Replies Latest reply: Jan 23, 2009 8:03 AM by Ezra Valerio Isacco Di Biase RSS

    Jboss 4.2.1 web session problem

    viswnadh vadlamannati Newbie

      Hi All,
      I configured my windows (xp) machine with 2 JBoss nodes (node1 and node2), by following the URL

      http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfiguringMultipleJBossInstancesOnOneMachine

      I created two nodes, node1 and node2. I copied all the folders from directory called "all" to both the nodes(node1 and node2).

      Next I changed the <JBOSS_HOME>/all/conf/jboss-service.xml file.
      Adding the nodes information under the attribute "Service Binding" as shown below.

      <mbean code="org.jboss.services.binding.ServiceBindingManager"
       name="jboss.system:service=ServiceBindingManager">
       <attribute name="ServerName">ports-01</attribute>
       <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
       <attribute name="StoreFactoryClassName">
       org.jboss.services.binding.XMLServicesStoreFactory
       </attribute>
       </mbean>
      
       <mbean code="org.jboss.services.binding.ServiceBindingManager"
       name="jboss.system:service=ServiceBindingManager">
       <attribute name="ServerName">ports-02</attribute>
       <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
       <attribute name="StoreFactoryClassName">
       org.jboss.services.binding.XMLServicesStoreFactory
       </attribute>
       </mbean>
      


      The sample-binding.xml file is having a example ports-01 and ports-02 information.

      Next I changed the <JBOSS_HOME>/node1/conf/jboss-service.xml .
      under the attribute "Service Binding" I added the below lines.
      <mbean code="org.jboss.services.binding.ServiceBindingManager"
       name="jboss.system:service=ServiceBindingManager">
       <attribute name="ServerName">ports-02</attribute>
       <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
       <attribute name="StoreFactoryClassName">
       org.jboss.services.binding.XMLServicesStoreFactory
       </attribute>
       </mbean>
      


      Same thing for node2 also, changed the "<JBOSS_HOME>/node1/conf/jboss-service.xml" file with above line ,ofcourse instead of node1 I changed it node2.

      Apart from these changes I didn't done any thing.I started my node 1 as

      run.bat -b <IP ADDRESS OF MY MACHINE> -c node1
      


      once it is started then I started the second node2 also.
      with the same command as shown above with node2.

      I observed that both are able to recognize. By seeing the below statements I confirmed that both are in cluster.

      11:07:16,343 INFO [DefaultPartition] I am (166.35.136.77:1299) received membershipChanged event:
      11:07:16,343 INFO [DefaultPartition] Dead members: 0 ([])
      11:07:16,343 INFO [DefaultPartition] New Members : 1 ([166.35.136.77:1199])
      11:07:16,359 INFO [DefaultPartition] All Members : 2 ([166.35.136.77:1299, 166.35.136.77:1199])
      11:07:16,921 INFO [TreeCache] viewAccepted(): [166.35.136.77:2342|7] [166.35.136.77:2342, 166.35.136.77:3242]
      



      I want to test whether my clustering environment is working fine or not.So I downloaded the Counter.war file ,and deployed it in "farm/node1" , once it is deployed , I was able to see the same war file in node2 farm/node2 also.

      Next using the URL ,I am trying to access the index.jsp page.

      http://IPADDRESS:8180/Counter/index.jsp
      


      I am able to see the below out put.
      session ID: 14A2E524B25759452569011337AAD950.node1
      You have hit this page 2 times
      


      I stopped the node1 JBoss instance.I haven't closed the browser and tested the same web page again,just pressing the refresh button again. It is not showing any change, just the above message.

      I was expecting that it has to show as shown below.
      session ID: 14A2E524B25759452569011337AAD950.node2
      You have hit this page 3 times
      


      But some how it was not showing that.
      Then I changed the URL as shown below

      http://IPADDRESS:8280/Counter/index.jsp
      


      I changed the port of the URL which is pointing to node2.
      Now I was able to see the expected message.

      My question here is , why should I need to change the port to node2. Why it is not going automatically, after I stopped node1. I was expecting that it has to goto node2 with out chaging any thing .

      Then some body suggested that , it is the expected behaviour , since you haven't configured load-balancer.

      But I was seeing when node1 and node2 was starting a message as shown below

      11:07:29,265 INFO [JBossCacheManager] We are using mod_jk(2) for load-balancing. Will add JvmRouteValve.
      11:07:29,625 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
      11:07:30,390 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-166.35.136.77-8180
      11:07:30,515 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-166.35.136.77-8109
      


      Even though I haven't configured any thing in JBoss or any thing in apache I was able to see the above messages when I start the node1 and node2.
      If nodes are showing that message then I thought that load-balancer is working. (might be a default load-balancer).

      Then I tried with load-balancer port (I thing it is 8009 in my case,since this is the default port which I saw,correct me if I am wrong).

      I am seeing an error message "page cannot be displyed"

      Can Any body suggest me why I need to change the port. Do I need to configure any thing.

      By the way I am using JBOss 4.2.1 GA (on windows XP).

      Thanks!
      VVK


        • 1. Re: Jboss 4.2.1 web session problem
          Brian Stansberry Master

          OK, so it sounds like you've seen http://wiki.jboss.org/wiki/Wiki.jsp?page=ReplicatedCounter since you're using the Counter.war. So, I'm going to be very brief; if you have any questions refer back to that page and the pages linked from it.

          JBoss AS is not a load balancer. A load balancer is an external process that listens on a known address/port and sends requests to a set of servers it is managing. It hides the mechanism it uses to communicate with the servers from the client; the client just needs to know the address/port of the load balancer.

          You need to configure an external load balancer if you want some external process to survive the shutdown of an AS and send requests to the ASs it's balancing.

          The fact that an AS is listening on port 8009 doesn't mean there is a load balancer somewhere. It just means that *if* there were a load balancer out there that uses the AJP protocol (e.g. mod_jk running on Apache httpd), that load balancer could contact that AS using port 8009.

          When you type http://IPADDRESS:8180/Counter/index.jsp you are telling your browser to directly contact an AS instance via HTTP. If you shut down that AS instance, of course a second request to that URL will not work.

          When you type http://IPADDRESS:8280/Counter/index.jsp you are telling your browser to directly contact the second AS instance via HTTP. That works, since that 2nd AS instance is still running.

          • 2. Re: Jboss 4.2.1 web session problem
            viswnadh vadlamannati Newbie

            Forgot to mention one thing.

            I changed a file in <JBOSS_HOME>/all/deploy/jboss-web.deployer/META-INF\jboss-service.xml

            in that I changed the attribute as


            For clustering purpose only.
             -->
             <attribute name="UseJK">true</attribute>
            
            


            previously it was false.

            and one more change also I did.
            In Node1 I changed the file node1/deploy/jboss-web.deployer/server.xml

            The attribute changed to




            <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
            


            same thing in node2/deploy/jboss-web.deployer/server.xml also.

            Thanks!
            VVk



            • 3. Re: Jboss 4.2.1 web session problem
              viswnadh vadlamannati Newbie

              Hi Thanks a lot for your reply.

              As I said ,I am using windows xp, do I need to use any thing other than,mod_jk.so file.

              After configuring all the stuff as explained in the document

              http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss

              and trying to test whether my configuration is working or not, it was throwing error as

              Syntax error on line 3 of C:/Program Files/Apache Group/Apache2/conf/mod-jk.conf
              :
              Cannot load C:/Program Files/Apache Group/Apache2/modules/mod_jk.so into server:
               The specified procedure could not be found.
              


              Do you have any idea what went wrong.

              Thanks !
              VVK

              • 4. Re: Jboss 4.2.1 web session problem
                Brian Stansberry Master

                Where did you put mod_jk.so?

                • 5. Re: Jboss 4.2.1 web session problem
                  viswnadh vadlamannati Newbie

                  HI ,

                  I put the mod_jk.so file at

                  C:\Program Files\Apache Group\Apache2\modules\modjk.so

                  and created all the required files under

                  C:\Program Files\Apache Group\Apache2\conf

                  the files are

                  workers.properties
                  mod-jk.conf
                  uriworkermap.properties
                  jkmount.properties

                  Thanks!
                  VVK

                  • 6. Re: Jboss 4.2.1 web session problem
                    Brian Stansberry Master

                    Rename the file mod_jk.so (notice the underscore.) The path from the root of Apached needs to match this from mod-jk.conf:

                    LoadModule jk_module modules/mod_jk.so

                    • 7. Re: Jboss 4.2.1 web session problem
                      viswnadh vadlamannati Newbie

                      Actually I mentioned like as you said.By mistake I wrote (modjk.so) like that in this forum. My apologies.

                      the entry in mod-jk.conf is

                      LoadModule jk_module modules/mod_jk.so

                      Thanks!
                      VVK



                      • 8. Re: Jboss 4.2.1 web session problem
                        viswnadh vadlamannati Newbie

                        I mean to say, the physical file name is same as it is in mod-jk.conf

                        C:\Program Files\Apache Group\Apache2\modules\mod_jk.so

                        Thanks!
                        VVK

                        • 9. Re: Jboss 4.2.1 web session problem
                          viswnadh vadlamannati Newbie

                          Hi , I reinstalled Apache 2.2.6 and configured with mod_jk-apache-2.2.4.
                          Then I tested , it was not throwing any error.
                          I thing it is configured properly.

                          (1) mod-jk.conf

                          # Load mod_jk module
                          # Specify the filename of the mod_jk lib
                          LoadModule jk_module modules/mod_jk.so
                          
                          # Where to find workers.properties
                          JkWorkersFile conf/workers.properties
                          
                          # Where to put jk logs
                          JkLogFile logs/mod_jk.log
                          
                          # Set the jk log level [debug/error/info]
                          JkLogLevel info
                          
                          # Select the log format
                          JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
                          
                          # JkOptions indicates to send SSK KEY SIZE
                          # Note: Changed from +ForwardURICompat.
                          # See http://tomcat.apache.org/security-jk.html
                          JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
                          
                          # JkRequestLogFormat
                          JkRequestLogFormat "%w %V %T"
                          
                          # Mount your applications
                          JkMount /__application__/* loadbalancer
                          
                          # You can use external file for mount points.
                          # It will be checked for updates each 60 seconds.
                          # The format of the file is: /url=worker
                          # /examples/*=loadbalancer
                          JkMountFile conf/uriworkermap.properties
                          
                          # Add shared memory.
                          # This directive is present with 1.2.10 and
                          # later versions of mod_jk, and is needed for
                          # for load balancing to work properly
                          # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
                          # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
                          JkShmFile run/jk.shm
                          
                          # Add jkstatus for managing runtime data
                          <Location /jkstatus/>
                          JkMount status
                          Order deny,allow
                          Deny from all
                          Allow from all
                          </Location>
                          


                          (2)workers.properties

                          # Define list of workers that will be used
                          # for mapping requests
                          # The configuration directives are valid
                          # for the mod_jk version 1.2.18 and later
                          #
                          worker.list=loadbalancer,status
                          
                          # Define Node1
                          # modify the host as your host IP or DNS name.
                          worker.node1.port=8009
                          worker.node1.host=166.35.136.77
                          worker.node1.type=ajp13
                          worker.node1.lbfactor=1
                          # worker.node1.connection_pool_size=10 (1)
                          
                          # Define Node2
                          # modify the host as your host IP or DNS name.
                          worker.node2.port=8009
                          worker.node2.host=166.35.136.77
                          worker.node2.type=ajp13
                          worker.node2.lbfactor=1
                          # worker.node1.connection_pool_size=10 (1)
                          
                          # Load-balancing behaviour
                          worker.loadbalancer.type=lb
                          worker.loadbalancer.balance_workers=node1,node2
                          
                          # Status worker for managing load balancer
                          worker.status.type=status
                          


                          (3)uriworkermap.properties

                          # Simple worker configuration file
                          #
                          
                          # Mount the Servlet context to the ajp13 worker
                          /jmx-console=loadbalancer
                          /jmx-console/*=loadbalancer
                          /web-console=loadbalancer
                          /web-console/*=loadbalancer
                          
                          


                          these are the configurations which made in apache side.

                          and at JBoss 4.2.1 side at the file

                          <JBOSS_HOME>\server\node1\deploy\jboss-web.deployer\server.xml

                          
                          <!-- Define an AJP 1.3 Connector on port 8009 -->
                           <Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
                           emptySessionPath="true" enableLookups="false" redirectPort="8443" />
                          
                           <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
                          
                          


                          and also at <JBOSS_HOME>\server\node1\deploy\jboss-web.deployer\META-INF\jboss-service.xml

                          I changed as

                          <attribute name="UseJK">true</attribute>
                          


                          Same as for node2 also.

                          Then I started apache first ,

                          next I started node1 with the following command

                          run.bat -b 166.35.136.77 -c node1
                          


                          Next I started node2 as same as above.

                          I tryed to run at brower by giving the URL as

                          http://166.35.136.77/Counter/index.jsp

                          it was throwing error.

                          Not Found
                          
                          The requested URL /Counter was not found on this server
                          


                          http://166.35.136.77:8009/Counter/index.jsp
                          throwing that the unable to connect

                          I checked in the mod_jk.log file ..It is saying that




                          
                          [Fri Oct 26 13:00:24 2007][1860:2896] [info] mod_jk.c (2277): Service error=0 for worker=loadbalancer
                          [Fri Oct 26 13:00:30 2007][1860:2896] [info] jk_lb_worker.c (1167): Forcing recovery once for 2 workers
                          [Fri Oct 26 13:00:31 2007][1860:2896] [info] jk_connect.c (473): connect to 166.35.136.77:8009 failed (errno=61)
                          [Fri Oct 26 13:00:31 2007][1860:2896] [info] jk_ajp_common.c (891): Failed opening socket to (166.35.136.77:8009) (errno=61)
                          [Fri Oct 26 13:00:31 2007][1860:2896] [info] jk_ajp_common.c (1311): (node1) error connecting to the backend server (errno=61)
                          [Fri Oct 26 13:00:31 2007][1860:2896] [info] jk_ajp_common.c (2085): (node1) sending request to tomcat failed, recoverable operation attempt=1
                          [Fri Oct 26 13:00:32 2007][1860:2896] [info] jk_connect.c (473): connect to 166.35.136.77:8009 failed (errno=61)
                          [Fri Oct 26 13:00:32 2007][1860:2896] [info] jk_ajp_common.c (891): Failed opening socket to (166.35.136.77:8009) (errno=61)
                          [Fri Oct 26 13:00:32 2007][1860:2896] [info] jk_ajp_common.c (1311): (node1) error connecting to the backend server (errno=61)
                          [Fri Oct 26 13:00:32 2007][1860:2896] [info] jk_ajp_common.c (2085): (node1) sending request to tomcat failed, recoverable operation attempt=2
                          [Fri Oct 26 13:00:32 2007][1860:2896] [error] jk_ajp_common.c (2097): (node1) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
                          


                          Can any body help me what went wrong.

                          Thanks!
                          VVK

                          • 10. Re: Jboss 4.2.1 web session problem
                            bharat bonde Newbie

                            I am facing the same problem.
                            I am using jboss v4.2.1.GA and apache v2.0.
                            Error like this means the requests from apache is not mounted on jboss.

                            Please help.

                            Do I need to install new version of apache?

                            • 11. Re: Jboss 4.2.1 web session problem
                              Brian Stansberry Master

                              If you want a particular URL pattern to pass through to JBoss you have to include it in uriworkermap.properties:

                              # Simple worker configuration file
                              
                              # Mount the jmx-console, web-console and Counter servlet contexts to the ajp13 worker
                              /jmx-console=loadbalancer
                              /jmx-console/*=loadbalancer
                              /web-console=loadbalancer
                              /web-console/*=loadbalancer
                              /Counter=loadbalancer
                              /Counter/*=loadbalancer


                              • 12. Re: Jboss 4.2.1 web session problem
                                Praveen Veluthakkal Newbie

                                Hi

                                I am also facing the same problem. Error message in mod_jk.log is given below. Any help would be greatly appreciated.

                                jk_connect.c (566): connect to 192.168.1.6:8009 failed (errno=61)
                                [Thu Apr 03 09:23:32 2008][5208:5500] [info] jk_ajp_common.c (869): Failed opening socket to (192.168.1.6:8009) (errno=61)
                                [Thu Apr 03 09:23:32 2008][5208:5500] [error] jk_ajp_common.c (1359): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
                                [Thu Apr 03 09:23:32 2008][5208:5500] [info] jk_ajp_common.c (2186): (node1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
                                [Thu Apr 03 09:23:33 2008][5208:5500] [info] jk_connect.c (566): connect to 192.168.1.6:8009 failed (errno=61)


                                Thanks & Regards,
                                Praveen V

                                • 13. Re: Jboss 4.2.1 web session problem
                                  Long Long Newbie

                                  dfsd dsf sdf dsf dsfds fds fd

                                  • 14. Re: Jboss 4.2.1 web session problem
                                    Ezra Valerio Isacco Di Biase Newbie

                                    vkviswanadh have you solved this issue? We encountered the same problem.

                                    thanks
                                    Ezra Di Biase