7 Replies Latest reply on Aug 16, 2005 11:15 AM by roberto

    Problem using HA-JNDI and Fail Over

      Maybe i have found a bug in the cluster environment if enterprise application use HA-JNDI.

      I'm using JBoss AS 4.0.1sp1 with jdk 1.4.2_07 on Windows XP using "all" configuration.

      I have tre machine:

      "HostA" : Load balance base on Apache 2.0 with mod_jk 1.2.x with sticky session
      "ClusterB" : Jboss AS 4.0.1 sp1 with my ear with war and ejb modules
      "ClusterC" : Jboss AS 4.0.1 sp1 with my ear the same than in ClusterB

      In this situation ALL WORKS fine.

      If a cliente request to HostA a resouce, this is forward to ClusterB or ClusterC according load balance rules.

      Http sessions are replicated too and credential is propagate across cluster.

      So the cluster that response to the client request shutdown, a new request from the client (in the same http session) is redirect the the alive cluster and all http session data are visible again.

      the web.xml have the attribute.
      ejb are not CLUSTERED because are local entity ejb and stateless session.

      And this is the correct behavior.

      Now my ear application need to use the HA-JNDI because i need to bind to the JNDI a object and this must be see across cluster.

      I know that to use HA-JNDI there are different ways:

      Solution 1:

      try
      {
      Properties properties = new Properties();
      properties.setProperty(javax.naming.Context.PROVIDER_URL, "localhost:1100");
      object = new InitialContext(properties).lookup("myinformation");
      }
      catch (Exception vErr)
      {}
      


      is the same setting as property jnp.partitionName the partition name (eg. "DefaultPartition")

      Solution 2:
      put in the classpath a jndi.properties with the provider url or partition name.
      In this case i can use object = new InitialContext().lookup("myinformation");




      I choose to use the second way because no change in my code is needed and i cannot "hard code" the value.

      So i have in my ear a indi.properties with:
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1100
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      #jnp.partitionName=DefaultPartition
      


      This works fine too. HA-JNDI works fine. but a big problem occurs when a cluster shutdown: all lookups fail with a NameNotBoundException!
      Seem that all the deployed/binded ejb are undeployed (maybe only for the HA-JNDI because if i go on jmx-console i can see the deployed ejb yet).
      And another problem http session data are lost (or maybe never replicated to clusters).

      Seem that when a cluster shutdown, the jboss container undeploy all and remove all http session using HA-JNDI, so undeploy over all cluster and remove http session data from all cluster.

      Any idea about it? or it's really a bug? or i haven't configured well how use HA-JNDI?

      I need to use HA-JNDI without change my code...


      Thank You

      Roberto

        • 1. Re: Problem using HA-JNDI and Fail Over

          Instead of shutdown clusterB i have unplug the lan cable.
          In this case when i try to reuse the browser (always unsing HA_JNDI) this exception occurs:

          java.lang.RuntimeException: JBossCacheService: exception occurred in cache remove after retry ...
           org.jboss.web.tomcat.tc5.session.JBossCacheService._remove(JBossCacheService.java:408)
           org.jboss.web.tomcat.tc5.session.JBossCacheService.removeSession(JBossCacheService.java:165)
           org.jboss.web.tomcat.tc5.session.SessionBasedClusteredSession.removeMyself(SessionBasedClusteredSession.java:168)
           org.jboss.web.tomcat.tc5.session.JBossCacheManager.remove(JBossCacheManager.java:387)
           org.apache.catalina.session.StandardSession.setId(StandardSession.java:349)
           org.jboss.web.tomcat.tc5.JvmRouteFilter.handleJvmRoute(JvmRouteFilter.java:165)
           org.jboss.web.tomcat.tc5.JvmRouteFilter.doFilter(JvmRouteFilter.java:109)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
          
          




          • 2. Re: Problem using HA-JNDI and Fail Over

            Roberto,

            I have tried to follow your description but I am still a little lost. Can you re-prhase your scenario?

            For example, what's the browser to do with HA-JNDI?

            -Ben

            • 3. Re: Problem using HA-JNDI and Fail Over

              ok.

              I have tre machine:

              "HostA" : Load balance base on Apache 2.0 with mod_jk 1.2.x with sticky session
              "ClusterB" : Jboss AS 4.0.1 sp1 with my ear with war and ejb modules
              "ClusterC" : Jboss AS 4.0.1 sp1 with my ear the same than in ClusterB

              in my ear i have also a jndi.properties to use HA-JNDI:

              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
              #java.naming.provider.url=jnp://localhost:1100
              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
              jnp.partitionName=DefaultPartition
              
              .


              Load balance is configure for sticky session.


              My client is a standard browser (Internet Explorer / Firefox).

              So a user using browser access to the HostA and so the request is forward for example to ClusterB.

              For now all work fine: the request is captured from a Servlet the lookup on JNDI using for example:
              try
              {
              ABSEQBAuthHome vHome = (ABSEQBAuthHome) new InitialContext().lookup("java:comp/env/ejb/ABSEQBAuth");
              }
              catch (Exception vErr)
              {}
              


              Setting a jndi.properties in the ear, this force to use port 1100 (HA-JNDI)

              Now i shutdown (CTRL-C) ClusterB.

              The user in the same browser session do another request and so the load-balance try to use again ClusterB, but now is died and so correctly forward the request to the alive clusterA.

              The request is always capture from the servlet that done another lookup (always using HA-JNDI), but now a NameNotFoundException occurs.

              I think that when the shutdown occurs all ejb are undeploy from the HA-JNDI....

              I hope to have describe better the scenario.

              Thank You
              Roberto



              • 4. Re: Problem using HA-JNDI and Fail Over

                Roberto,

                Sounds like a problem. Would you go to jira.jboss.com and open a bug against the application server. You can assign it to me. If you can, please attached your sample war and ear files.

                Thanks,

                -Ben

                • 5. Re: Problem using HA-JNDI and Fail Over

                  ok.
                  i do it asap.

                  i must prepare a test case ear (i cannot attach my real application. The little one it's about 40 MB)

                  • 6. Re: Problem using HA-JNDI and Fail Over
                    • 7. Re: Problem using HA-JNDI and Fail Over

                      On Jira issue was closed as a non bug!
                      But so.. please can someone help me to resolve the problem?
                      I was sure that there is a bug like Wang says... and so i wait for new version since April.. and now.. is not a bug.. so no fix will be released.... and now is August!
                      Maybe this is true... i wrong something in my configuration.... but what?
                      Remember: i cannot change my java code....
                      Thank You to all