8 Replies Latest reply on Sep 8, 2003 4:15 AM by null null

    HttpSession replication under Tomcat

    Andi Jud Newbie

      I am in doubt whether HttpSession replication does work under Tomcat.
      I am deploying a very simple war file (see attachment) which just fills a String value into the session. The result page displays the value.
      In front I put an Apache 2, mod_jk2 loadbalancer. As soon as it starts toggling I receive different session attribute values.
      Yes, I put distributable into web.xml. Both nodes know each other. I use the instant snapshot mode. I tested with jboss-3.0.7_jakarta-tomcat-4.1.24 and jboss-3.2.1_tomcat-4.1.24. Yes, I read the cluster docu.

      Any ideas from your side?

        • 1. Re: HttpSession replication under Tomcat
          Dennis Cartier Newbie

          The HttpSession replication *DOES* work under Tomcat. I have 4 nodes in a cluster using it now with jboss-3.0.7_jakarta-tomcat-4.1.24 and mod_jk behind Apache2. I do not use JK2 as I found it too confusing, perhaps later the docs will catch up to the code.

          You should check to make sure you have a JVM route set properly on each node and then check the partitionName=DefaultPartition,service=DistributedState under the JBoss section in the jmx-console application. Clicking on the java.lang.String listContent() should list all the distributed sessions and you should see ones from various nodes (the node name will be on the end).

          Example:

          -----------------------------------------------
          Category : CMPClusteredInMemoryPersistenceManager-ClusteredHTTPSession

          KEY : VALUE
          "pQqXlC5A9h0b0Yq8T8+9gw**.tomcat3" : "[B@3dfb00e2"
          "jQLD2DlGmd5Dg9LEXmkENA**.tomcat1" : "[B@532e40e2"
          "Uf2NfHE66f7rlz6ljbV1og**.tomcat1" : "[B@5d07c0e3"
          "si7L02QP0XV7ZxSBafaG7A**.tomcat3" : "[B@5ab600e3"
          "5VGxRqQMU7bVOO76SOL9XA**.tomcat2" : "[B@621900e9"
          "8ZB1jxfSoVddPEGhU+LXXA**.tomcat1" : "[B@3edf80e2"
          "jXLaKJtYfluZ6GJGT2zPbA**.tomcat1" : "[B@289740e2"
          "-cJiJJcKD5tMNNTi6JxMzg**.tomcat1" : "[B@7901c0e2"
          "-6sc+6b6kLpv+5ncXylHsg**.tomcat1" : "[B@291340c2"
          "pdvTY74HfSgoQ-zYpenEWA**.tomcat4" : "[B@6b4380f1"
          "4e2-jhqWfFYfPzacKt1sng**.tomcat1" : "[B@2b30c0e2"
          "kzWQMJIorFYIuPATwLyY4g**.tomcat1" : "[B@522ac0e2"
          "k4SrXscjf1UJ3VEww85lcQ**.tomcat1" : "[B@2c0d00e2"
          "sAKr-47VypBdi9K1fyOXNg**.tomcat4" : "[B@2f3080e2"
          "zp1MsWTuooGejMzwMcOnqg**.tomcat1" : "[B@529200e2"


          It does work keep at it.

          Dennis

          • 2. Re: HttpSession replication under Tomcat
            toniali Newbie

            HttpSession replication does work on jboss-3.2.1_tomcat-4.1.24, but it does not work on jboss-3.0.6_tomcat-4.1.*.

            After the first server is dead, the second server takes more than 2 minutes to replicate the httpsession. I mean the failover takes 2 minutes. The two servers are located on two Solaris boxes.

            In jboss-service.xml for tomcat, I use synchronously replicates changes to the other nodes.

            The above test is based on a manual test. We are going to do some load testing to test the failover. I'll post the result after we complete the testing.

            • 3. Re: HttpSession replication under Tomcat
              Dennis Cartier Newbie

              I also used JBoss 3.0.6_tomcat-4.1.18 previously (before 3.0.7) and it worked fine. Fail over was instanteous. Toniali, I would suggest you examine your setup as there must be something wrong. Sessions are replicated continuously, not just when a node fails.

              This was all on Linux however, but I doubt that it makes a difference.

              Dennis

              • 4. Re: HttpSession replication under Tomcat
                Andi Jud Newbie

                Thank you for your advise! It works now with jboss-3.2.1_tomcat-4.1.24 on w2k.

                I added the jvmRoute to the jboss-service.xml. I do have sticky sessions now and failover works perfectly.
                It's fundamental to define the correct jvmRoute string when using mod_jk2 load balancing. jvmRoute must equal the tomcatId, where tomcatId = host:port, for example sgw2fs01:8009 in case of a definition "[channel.socket:sgw2fs01:8009]" in workers2.properties.

                Be carfeful and do not use an ip address for the host. Instead use the host name. Any dot in the host definition confuses the correct routing within JBoss.
                I guess it's ClusterManager which lacks to manage that.

                • 5. Re: HttpSession replication under Tomcat
                  Thomas Peuss Newbie

                  > Be carfeful and do not use an ip address for the
                  > host. Instead use the host name. Any dot in the host
                  > definition confuses the correct routing within
                  > JBoss.
                  > I guess it's ClusterManager which lacks to manage
                  > that.

                  You are right. I am looking for the LAST dot to strip of the JVM-Route. I have a look at this...

                  CU
                  Thomas

                  • 6. Re: HttpSession replication under Tomcat
                    Thomas Peuss Newbie

                    I committed the changed jvmRoute-handling to CVS. I now take the first occuring dot. This is safe because the generated sessionid contains no dots...

                    CU
                    Thomas

                    • 7. Re: HttpSession replication under Tomcat
                      Liu Shan Newbie

                      I add

                      into jboss-service.xml,but can only get:
                      Operation listContent Results
                      Back to Agent View
                      Back to MBean View
                      --------------------------------------------------------------------------------

                      -----------------------------------------------
                      Category : CMPClusteredInMemoryPersistenceManager-ClusteredHTTPSession

                      KEY : VALUE
                      'NGXH0fG0pK-j-VPYiOhS0A**' : '[B@12a09d5'
                      'QZUcSz+iflOgliG2etmNoA**' : '[B@eb9f58'
                      'k-8Jer+lljCqRqLzLL5hFQ**' : '[B@12a7c1e'
                      'PEbdaXZ01XFd1QX0UNDPGg**' : '[B@18a80d4'
                      'QKgFavjgjuhDL-HVgBl4Yw**' : '[B@ce41cc'
                      'W4KrmqZQVhHI7EMSJm88Nw**' : '[B@3a9c52'
                      'EL1W4HODLszA3x27etCl0Q**' : '[B@1ecfcd9'
                      '3fK3NBrZ1KZpcw8qLP323A**' : '[B@168c1e1'
                      'dnXKKJbpZeKwiZ-J89Opcg**' : '[B@1cc1f09'
                      '9GCQMVtNWmJUij6OZOtgZA**' : '[B@6b3fc7'
                      '0DuXpWsJsNs6oI84Jn536A**' : '[B@1dd1ed2'
                      'bJ4rqJIFmQJBNDqxaqnrlA**' : '[B@9a47d'
                      'PLRA1sWVDVnCvVM4cHAWiA**' : '[B@6399ae'
                      'JwMhj5ebmGJOqc8RMHjhWQ**' : '[B@e9c592'
                      '2PV+he335K1rBRuBnmQXbA**' : '[B@10e284f'
                      'Hcg6O4Dwi3lfa7An2okWxA**' : '[B@788315'
                      'gNTMwLopcwK71-MtO2Rx0w**' : '[B@10bbf6d'
                      'pju61A2CmFT0AlkHjaK4uQ**' : '[B@1e5ed7b'
                      'L8Ek1D1m4toReElphgWSGg**' : '[B@5c18ff'
                      'x5czIc1tJGrUDmmmMZMybw**' : '[B@4a4e31'
                      'r0JX-ns9P0Z1QAgV2vsHjQ**' : '[B@18ed284'
                      'IPZoq5BQbOr59HC3sZLB3Q**' : '[B@538cc2'

                      Do not get node name .
                      What wrong with it?
                      Thanks in advance.

                      • 8. Re: HttpSession replication under Tomcat
                        null null Newbie

                        Hai Everybody,
                        I've installed JBoss-4.0 and I'm able to configure 2 instances of Jboss and could see the 2 instances in cluster. Also, I could deploy stateful session bean successfully. But while accessing the jsps, I'm getting an exception "Non-serializable attribute"for the attribute which is of String type. Also, I'm getting warning message "No tx support found for method: findByPrimaryKey
                        No tx support found for method: create
                        No tx support found for method: setSession"

                        Can anybody help me how to proceed?

                        Thanks in advance.