8 Replies Latest reply on Apr 24, 2011 11:49 PM by Emre He

    jboss 5 ejb invoke issue

    Emre He Newbie

      Hello,

       

      Here i met one tricky issue, my test bed is one cluster environemnt based on jboss 5.1.0.as, 2 nodes:

      active node: 192.168.100.1

      standby node: 192.168.100.2

      floating ip address hich we used to access service on jboss 5.1.0.as: 192.168.100.3

       

      i have one ejb service ejb/MyApp deployed on both nodes, its function is insert records in local node database.

       

      my service need to invoke ejb/MyApp to insert records, the successful scenario is: ejb/MyApp on both node should be invoked separately, so the record should be inserted in databse on both nodes, but the issue i met is:

       

      1. step 1: my service invoke ejb/MyApp on active node, it succeed to insert record in active node 192.168.100.1;

      2. step 2: my service try to invoke ejb/MyApp on standby node, it finally still invoke the ejb/MyApp on active node, so it try to insert record in active node again, so database insert error is raising.

      from the log, i can see the ejb jndi lookup is already finding and cache the ejb info on standby node:

       

      {code}2011-04-13 15:55:09,110 DEBUG [net.sf.ehcache.Cache] (WorkManager(2)-8__EJBHomeLookup 1) ServiceLocator : Is element with key 192.168.100.2ejb/MyApp expired?: true

      2011-04-13 15:55:09,110 DEBUG [net.sf.ehcache.Cache] (WorkManager(2)-8__EJBHomeLookup 1) ServiceLocator  Memory cache hit, but element expired

      2011-04-13 15:55:09,111 INFO   (WorkManager(2)-8__EJBHomeLookup 1) (ServiceLocator.java:338) getInitialContext(192.168.100.2)

      2011-04-13 15:55:09,111 INFO   (WorkManager(2)-8__EJBHomeLookup 1) (ServiceLocator.java:338) getInitialContext(192.168.100.2)

      2011-04-13 15:55:09,111 DEBUG  (WorkManager(2)-8__EJBHomeLookup 1) (ServiceLocator.java:389) lookup in ctx= javax.naming.InitialContext@218c69

      2011-04-13 15:55:09,111 DEBUG  (WorkManager(2)-8__EJBHomeLookup 1) (ServiceLocator.java:389) lookup in ctx= javax.naming.InitialContext@218c69

      2011-04-13 15:55:09,111 DEBUG [org.jnp.interfaces.TimedSocketFactory] (WorkManager(2)-8__EJBHomeLookup 1) createSocket, hostAddr: /192.168.100.2, port: 1099, localAddr: null, localPort: 0, timeout: 0

      2011-04-13 15:55:09,112 FINE  [sun.rmi.loader] (WorkManager(2)-8__EJBHomeLookup 1) WorkManager(2)-8__EJBHomeLookup 1: name = "org.jnp.server.NamingServer_Stub", codebase = "http://192.168.100.2:8083/", defaultLoader = org.jboss.util.loading.DelegatingClassLoader@1bc16f5

      2011-04-13 15:55:09,113 FINE  [sun.rmi.loader] (WorkManager(2)-8__EJBHomeLookup 1) WorkManager(2)-8__EJBHomeLookup 1: name = "java.rmi.server.RemoteStub", codebase = "http://192.168.100.2:8083/", defaultLoader = org.jboss.util.loading.DelegatingClassLoader@1bc16f5

       

       

      2011-04-13 15:55:09,130 DEBUG  (WorkManager(2)-8__EJBHomeLookup 1) (ServiceLocator.java:395) ejb/MyApp of host 192.168.100.2 cached

      {code}

       

       

       

      could anyone help to identify the root cause? is there something wrong on my cluster, ejb configuration? acutally there is no issue on jboss 4.0.3sp1 platform, after i try to merge service to jboss 5.1.0, this issue happend.

       

      thanks,

      Emre

        • 1. jboss 5 ejb invoke issue
          Wolf-Dieter Fink Master

          I suppose the root cause is 'misunderstanding JBoss cluster'

           

          With a JBoss cluster you did not have a active and standby node. Both (all) nodes are active, if you are using the RemoteInterfaces of an EJB it will be loadbalanced (first call to node1, second call (same remote-object) call to node2).

           

          The idea is that the JBoss provide loadbalancing and failover, the database behind must provide also a failover or mirroring!

           

          What you try to do is to have a active and standby instance of JBoss and DB to be fail save.

          In this case you must have dedicated JBoss instances, NO CLUSTER.

          Your application call both JBoss instances seperate and do the mirroring.

           

          For me this solution sounds strange, I prefere a real JBoss cluster and a failsave DB instance.

          This avoid a lot of extra work in the application

          • 2. jboss 5 ejb invoke issue
            Emre He Newbie

            Hello again Wolf-Dieter ,

             

            thanks for your detailed response!

             

            actaully my service is a MDB which triggered by message coming, from my service log, i can make sure this message is triggered on active node, i mean from the log i can see all the ejb/MyApp invoking operation is on active node, both local and remote, but when invoke remote ejb, it still invoke the local ejb to insert record, so it caused the db error. 

             

            p.s. on database level, there are other services are keeping sync on background, i can not change current framework

            • 3. jboss 5 ejb invoke issue
              Wolf-Dieter Fink Master

              If you reach the server the optimization is that, nevertheless you call remoteIF, the local EJB was called ( bad for you).

               

              Two possible solutions com up to my mind ...

              - use two queues from client (change the client sounds not very handy )

              - use a second internal queue or topic for replication and deploy this app only at the backup nodes

               

              but both sounds not really perfect to me

              • 4. jboss 5 ejb invoke issue
                Emre He Newbie

                Hello Wolf-Dieter,

                 

                could it be my ejb/rmi/jndi configuration issue?

                 

                thanks,

                Emre

                • 5. jboss 5 ejb invoke issue
                  Wolf-Dieter Fink Master

                  AFAIK you should instantiate a InitialContext of the other server and lookup the bean because you are not in the same cluster ...

                  • 6. jboss 5 ejb invoke issue
                    Emre He Newbie

                    Here are some progress but still have not got the root cause.

                    i set the jboss.bind.address with one ip address(which is for rmi register) as jboss5 startup parameters, now the ejb invoke on standby server can be done successfully.

                    • 7. jboss 5 ejb invoke issue
                      Wolf-Dieter Fink Master
                      i set the jboss.bind.address with one ip address(which is for rmi register) as jboss5 startup parameters, now the ejb invoke on standby server can be done successfully.

                      Sounds that you get it working.

                      But what does you mean by this: ??

                      Here are some progress but still have not got the root cause.
                      • 8. jboss 5 ejb invoke issue
                        Emre He Newbie

                        yes currently it works after i add the jboss.bind.address parameter when jboss startup, but i have not understood why this address will impact the invoke.

                         

                        thanks Wolf-Dieter for your help! i will close this discussion thread.