6 Replies Latest reply on Nov 14, 2006 10:29 PM by mp123

    Is it possible to execute Petstore demo in cluster mode??

    mp123

      Hello All,

      I would like to run the Petstore Demo Application on JBoss 4.0.4GA in 'all' mode of Cluster Configuration with two machines.

      I got the error while confirmOrder button clicked on webconsole, as follows.

      10:19:04,195 INFO [STDOUT] sendToJMSQueue(java:comp/env/jms/queue/xpetstore/order,1,false)
      10:19:04,270 ERROR [LogInterceptor] EJBException in method: public abstract java.lang.Integer xpetstore.services.petstore.interfaces.PetstoreLocal.createOrder(java.lang.String,java.util.Date,java.util.Map) throws xpetstore.services.petstore.exceptions.CartEmptyOrderException,javax.ejb.FinderException,javax.ejb.CreateException, causedBy:
      javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: queue not bound]
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1067)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:700)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:716)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at xpetstore.util.JMSUtil.sendToJMSQueue(Unknown Source)
       at xpetstore.services.petstore.ejb.PetstoreEJB.createOrder(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      ..
      ..
      ..
      


      Please tell me, what all the other changes need to do with JMS in Petstore application for running it in Cluster mode.



        • 1. Re: Is it possible to execute Petstore demo in cluster mode?

          NameNotFound is understandable since JBossMQ is deployed as singleton and I bet this exception happens on the Node that does not have JBossMQ started. If you were to look at the JndiView (via JMX console) you won't find any Queues and/or Topics deployed. In oher words it is expected result if. . . JNDI "autodiscovery" disabled, some other jndi properties changed and so on...

          Autodiscover feature that is a part of JBoss clustered JNDI lookup should make an attempt to find a node in the cluster which is able to serve such JNDI request if initial lookup failed. . . before NameNotFound is thrown

          Did you change anything in jndi.properties file?
          Could you post a code snippet how the lookup is made?
          Are you passing a specific properties to the InitialContext?
          and
          I assume queues and topics are deployed and started on the Master node (the one that is currently running JBossMQ)

          • 2. Re: Is it possible to execute Petstore demo in cluster mode?
            mp123

            Hello,
            Thanks for your reply.

            Actually, I have run the two servers named node1 and node2 with Apache modjk load balancer by keeping node1 as the main node and it only bound the queue/order and queue/mail.

            I have did the below modification in both the server machines node1 as well as node2.

            I have copied the jndi.properties file from <JBOSS_HOME>/server/node1/conf/ path and copied to <JBOSS_HOME>/server/node1/lib/ path and with the following modifications.

            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            java.naming.provider.url=<node1-ipaddress>:1100, <node2-ip address.:1100
            


            And, the lookup of queue is taken place in the application as follows.

            In the file,
            "<PETSTORE_HOME>/xpetstore-ejb/java/xpetstore/util/JMSUtil.java"
             ic = new InitialContext( );
            
             Queue queue = ( Queue ) ic.lookup( queueName );
            
             QueueConnectionFactory factory = ( QueueConnectionFactory ) ic.lookup( JNDINames.QUEUE_CONNECTION_FACTORY );
             cnn = factory.createQueueConnection( );
            


            While running the application, all the transaction is done by node1 till clicking the Submit button for sending mail to user. When I hit the submit button, the transaction goes to the second node node2 in which the queue is not bound.

            1. While two server is running, the sending of mail is not done and error comes as shown my post above.
            2. If any of one node is down, its automatically bound the queue and running the petstore application successfully.

            My problem is, the application should run successfully when all the nodes in the cluster are active.

            Please help me.

            • 3. Re: Is it possible to execute Petstore demo in cluster mode?

              1. What was the reason for moving jndi.properties file from "conf" to "lib" directory?
              2. Is node1 and node2 joined in JBoss Cluster or they are just two independent nodes under RoundRobin controll of mod_jk? Seem to me you do not have JBoss Cluster estalished and node1 and node2 are independent nodes where only node1 running JBossMQ. Is that correct?
              3. Node1 and node2 derived from "all" configuration or "default"?

              With default JBoss behavior when running in the cluster you wouldn't even have to specify provider url, since JGroups auto-discovery is enabled by default and your "Master" (the one that running JBossMQ singleton) node would be discovered before NameNotFound exception is thrown.

              • 4. Re: Is it possible to execute Petstore demo in cluster mode?
                mp123

                Hello,

                Thanks once again for ur quick response.

                "azhurakousky" wrote:
                1. What was the reason for moving jndi.properties file from "conf" to "lib" directory?


                I assumed that the application needs jndi.properties for looking up the JNDI Name. So, I thought the application will look on to the 'lib' directory for that file.

                2. Is node1 and node2 joined in JBoss Cluster or they are just two independent nodes under RoundRobin controll of mod_jk? Seem to me you do not have JBoss Cluster estalished and node1 and node2 are independent nodes where only node1 running JBossMQ. Is that correct?


                Node 1 and Node 2 are joined in JBoss Cluster only. It detects automatically the another node if the other one also started up. Same configurations done on both nodes.

                3. Node1 and node2 derived from "all" configuration or "default"?


                Yes. I have created node1 and node2 from 'all' configuration of JBoss 4.0.4.GA only and I'm working on Unix.

                node1 => working in one server machine <node1 - ip addr>
                node2 => working in another server machine <node2- ip addr>

                With default JBoss behavior when running in the cluster you wouldn't even have to specify provider url, since JGroups auto-discovery is enabled by default and your "Master" (the one that running JBossMQ singleton) node would be discovered before NameNotFound exception is thrown.


                As specified earlier, the queue bounds on one node say node1, and when the order confirmed and when we hit the Submit button, it should send mail to the customer. Till this, it looks only node1. But, what happens is, it checks the queue/mail in the another node (node2) where the queue not bound.

                Please tell me, how to enable the Auto-discovery of JGroups to avoid NameNotFound exception?


                • 5. Re: Is it possible to execute Petstore demo in cluster mode?

                  Try this really quick and let me know if you still have this problem. Then we'll try to simplify scenario to see what is wrong.

                  1. Move jndi.properties file back into the /conf directory of bothe servers (that is where JBoss is expecting it!!!).
                  2. From that file remove provider.url property (or coment it).


                  Run your app and tell me if you still have this issue

                  P.S. auto-descivery is enebled by default. All I cared about if you disabled it, but I don't see it happening from configurations provided.

                  • 6. Re: Is it possible to execute Petstore demo in cluster mode?
                    mp123

                    Hello,

                    I have done already the scenario you specified as moving jndi.properties to conf/ directory and remove the provider.url line.
                    But, No effects.
                    It gives the same error as I mensioned my previous post.

                    Is it need to set any Interceptors in the Application code?

                    Since, the application Petstore is running well under non-cluster environment. And, I'm trying to run it in the Clustered Environment.

                    So, I suppose that, need to set Interceptors in Application side. But, I don't know where and how..

                    Please help me.