8 Replies Latest reply on Sep 11, 2008 5:18 PM by dvh75

    MDB cannot be created when running in "all" configuration

    gan.gary

      I have a JBoss app. When it's running in "default" configuration on different PC in the network (let say: 10.10.10.10, 10.10.10.11, 10.10.10.12) with this MDB, everything is fine (context/global JNDI can be created).


      @MessageDriven(activationConfig =
      {
      
       @ActivationConfigProperty(propertyName="destination", propertyValue="queue/XXX/YYY
      })


      but when runnning in "all" configuration, the MDB only can be created by first Jboss (let say: 10.10.10.10) in network, the subsequent running JBoss instance ((let say: 10.10.10.11, 10.10.10.12) detected the running instance, seems clustering it automatically, causes the MDB on folowing JBoss instance cannot created. Any idea?

        • 1. Re: MDB cannot be created when running in
          gan.gary

          from the server.log, I can tell the second(or following running JBoss instance) in the network is clustered:

          INFO [org.jboss.ha.framework.interfaces.HAPartition.DefaultPartition] Number of cluster members: 2


          • 2. Re: MDB cannot be created when running in
            jaikiran

             

            "gan.gary" wrote:


            but when runnning in "all" configuration, the MDB only can be created by first Jboss (let say: 10.10.10.10) in network, the subsequent running JBoss instance ((let say: 10.10.10.11, 10.10.10.12) detected the running instance, seems clustering it automatically, causes the MDB on folowing JBoss instance cannot created. Any idea?


            When you say, the MDB fails, do you see any exception (I remember seeing your other post where you had posted about NameNotFoundException, is it the same exception you are seeing)?

            In the "all" configuration, the queues are deployed in the deploy-hasingleton folder. According to the docs http://wiki.jboss.org/wiki/HASingletonDeployer

            deploy-hasingleton Directory

            Since JBoss 3.2.4, server configuration "all " offers a deployment directory that contains services that are deployed on exactly one node in the cluster.

            So anything in this folder will be deployed only on one node.


            • 3. Re: MDB cannot be created when running in
              gan.gary

              thanks, you still can remember my last post :) . The first in cluster will get:

              2008-08-22 12:13:06,152 WARN [org.jboss.ejb3.mdb.MessagingContainer] destination not found: queue/XXX/YYY reason: javax.naming.NameNotFoundException: queue/XXX/YYY
              2008-08-22 12:13:06,152 WARN [org.jboss.ejb3.mdb.MessagingContainer] creating a new temporary destination: queue/XXX/YYY
              2008-08-22 12:13:06,152 DEBUG [org.jboss.mq.server.jmx.DestinationManager] Attempting to create destination: jboss.mq.destination:service=Queue,name=XXX/YYY; type=org.jboss.mq.server.jmx.Queue


              the subsequent one will get:

              2008-08-22 12:17:48,285 WARN [org.jboss.ejb3.mdb.MessagingContainer] Could not find the queue destination-jndi-name=queue/XXX/YYY
              2008-08-22 12:17:48,295 WARN [org.jboss.ejb3.mdb.MessagingContainer] destination not found: queue/XXX/YYY reason: javax.naming.NameNotFoundException: queue not bound
              2008-08-22 12:17:48,295 WARN [org.jboss.ejb3.mdb.MessagingContainer] creating a new temporary destination: queue/XXX/YYY
              2008-08-22 12:17:48,305 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Starting failed jboss.j2ee:jar=ZZZ.jar,name=WWW,service=EJB3
              javax.management.InstanceNotFoundException: jboss.mq:service=DestinationManager is not registered.
               at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:523)
              ...
              2008-08-22 12:17:48,305 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jar=ZZZ.jar,name=WWW,service=EJB3
              javax.management.InstanceNotFoundException: jboss.mq:service=DestinationManager is not registered.
               at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:523)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
              

              during start-up.

              • 4. Re: MDB cannot be created when running in
                jaikiran

                I just tried a similar thing on my setups. I created a MDB pointing to a non-existent queue (queue/ABC) and placed that EAR file in the farm folder of "all".

                @MessageDriven(activationConfig =
                {
                @ActivationConfigProperty(propertyName="destinationType",
                propertyValue="javax.jms.Queue"),
                @ActivationConfigProperty(propertyName="destination",
                propertyValue="queue/ABC")
                })
                public class MyMDB implements MessageListener {
                


                The queue was non-existent so it created a temporary queue:
                2008-08-28 16:46:11,191 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
                2008-08-28 16:46:11,191 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Starting jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
                2008-08-28 16:46:11,222 DEBUG [org.jboss.ejb3.tx.UserTransactionImpl] new UserTx: org.jboss.ejb3.tx.UserTransactionImpl@1eb424b
                2008-08-28 16:46:11,238 DEBUG [org.jboss.ejb3.interceptor.EJB3InterceptorsFactory] Bound interceptors for joinpoint: public void org.myapp.ejb.impl.MyMDB.onMessage(javax.jms.Message) - [Lorg.jboss.ejb3.interceptor.InterceptorInfo;@e26ae7
                2008-08-28 16:46:11,238 INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: org.myapp.ejb.impl.MyMDB ejbName: MyMDB
                2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Initializing
                2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Looking up provider adapter: java:/DefaultJMSProvider
                2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Provider adapter: org.jboss.jms.jndi.JNDIProviderAdapter@1cbc39b
                2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] context: javax.naming.InitialContext@1059849
                2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Got destination type Queue for MyMDB
                2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] jndiSuffix: ABC
                2008-08-28 16:46:11,332 WARN [org.jboss.ejb3.mdb.MessagingContainer] Could not find the queue destination-jndi-name=queue/ABC
                 2008-08-28 16:46:11,332 WARN [org.jboss.ejb3.mdb.MessagingContainer] destination not found: queue/ABC reason: javax.naming.NameNotFoundException: queue/ABC
                 2008-08-28 16:46:11,332 WARN [org.jboss.ejb3.mdb.MessagingContainer] creating a new temporary destination: queue/ABC
                 2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.DestinationManager] Attempting to create destination: jboss.mq.destination:service=Queue,name=ABC; type=org.jboss.mq.server.jmx.Queue
                2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] Creating service jboss.mq.destination:service=Queue,name=ABC
                2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.register: [jboss.mq:service=DestinationManager]
                2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] recording that jboss.mq.destination:service=Queue,name=ABC depends on jboss.mq:service=DestinationManager
                2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.Queue.ABC] Creating jboss.mq.destination:service=Queue,name=ABC
                2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.Queue.ABC] Created jboss.mq.destination:service=Queue,name=ABC
                2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.mq.destination:service=Queue,name=ABC dependents are: []
                2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] starting service jboss.mq.destination:service=Queue,name=ABC
                2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.Queue.ABC] Starting jboss.mq.destination:service=Queue,name=ABC
                2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Restored 0 message(s) to: QUEUE.ABC 0 need recovery.
                2008-08-28 16:46:11,347 INFO [org.jboss.mq.server.jmx.Queue.ABC] Bound to JNDI name: queue/ABC
                


                Then i started another node in the cluster and the EAR was picked up by the farm service. When the MDB was being deployed, the queue was not created again because the node found it already existing in the cluster:

                2008-08-28 16:48:40,177 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Creating jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
                2008-08-28 16:48:40,177 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Created jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
                2008-08-28 16:48:40,193 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3 dependents are: []
                2008-08-28 16:48:40,193 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
                2008-08-28 16:48:40,193 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Starting jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
                2008-08-28 16:48:40,209 DEBUG [org.jboss.ejb3.tx.UserTransactionImpl] new UserTx: org.jboss.ejb3.tx.UserTransactionImpl@5ec940
                2008-08-28 16:48:40,224 DEBUG [org.jboss.ejb3.interceptor.EJB3InterceptorsFactory] Bound interceptors for joinpoint: public void org.myapp.ejb.impl.MyMDB.onMessage(javax.jms.Message) - [Lorg.jboss.ejb3.interceptor.InterceptorInfo;@d16610
                2008-08-28 16:48:40,224 INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: org.myapp.ejb.impl.MyMDB ejbName: MyMDB
                2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Initializing
                2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Looking up provider adapter: java:/DefaultJMSProvider
                2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Provider adapter: org.jboss.jms.jndi.JNDIProviderAdapter@1d29ee4
                2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] context: javax.naming.InitialContext@1945696
                2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Got destination type Queue for MyMDB
                2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] jndiSuffix: ABC
                2008-08-28 16:48:40,302 DEBUG [org.jboss.mq.referenceable.SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance()
                2008-08-28 16:48:40,302 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Initialized with config org.jboss.ejb3.mdb.MDB@114a707
                


                The MDB was deployed properly.

                I even tried removing the deployments from the farm folder and placing them in the "deploy" folder of the individual nodes. Even that worked without any errors.

                • 5. Re: MDB cannot be created when running in
                  gan.gary

                   

                  "jaikiran" wrote:

                  Then i started another node in the cluster and the EAR was picked up by the farm service. When the MDB was being deployed, the queue was not created again because the node found it already existing in the cluster:

                  what if I want it to be created on the second node. I found thought it's clustered, my client cannot see the context/global JNDI.

                  • 6. Re: MDB cannot be created when running in
                    dvh75

                    Gents,

                    You'll want to change your MDBs to look in the global jndi tree for the JMS Queue/Topic it is trying to bind to. See this wiki entry:

                    http://wiki.jboss.org/wiki/HowToConfigureMDBsToSubscribeToATopic

                    Basically, since the JMS Server (Jbossmq) is a cluster singleton and so are its destinations, you'll need to use the cluster port (1100 by default) instead of the local (1099) jndi port. Otherwise your MDBs will never start because they are dependant on the DestinationManager service (again only runs on the active jms node)

                    Hope this helps...

                    • 7. Re: MDB cannot be created when running in
                      dvh75

                      sorry, I should have been more explicit, as the wiki post is lacking.

                      In your jms-ds.xml, look for the JMSProviderLoader mbean. It's entry should be changed to look something like this:


                      <!-- The JMS provider loader -->
                       <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                       name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider">
                       <attribute name="ProviderName">DefaultJMSProvider</attribute>
                       <attribute name="ProviderAdapterClass">
                       org.jboss.jms.jndi.JNDIProviderAdapter
                       </attribute>
                       <!-- The combined connection factory -->
                       <attribute name="FactoryRef">XAConnectionFactory</attribute>
                       <!-- The queue connection factory -->
                       <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
                       <!-- The topic factory -->
                       <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
                       <!-- Access JMS via HAJNDI -->
                       <attribute name="Properties">
                       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                       java.naming.provider.url=${jboss.bind.address:localhost}:1100
                       jnp.disableDiscovery=false
                       jnp.partitionName=${jboss.partition.name:DefaultPartition}
                       jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
                       jnp.discoveryPort=1102
                       jnp.discoveryTTL=16
                       jnp.discoveryTimeout=5000
                       jnp.maxRetries=1
                       </attribute>
                       </mbean>



                      • 8. Re: MDB cannot be created when running in
                        dvh75

                        Actually, ixnay the cache config stuff, I don't think it needs to be there since its a master/slave setup...

                        Or am I wrong (anyone?)

                        <!-- The JMS provider loader -->
                         <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                         name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider">
                         <attribute name="ProviderName">DefaultJMSProvider</attribute>
                         <attribute name="ProviderAdapterClass">
                         org.jboss.jms.jndi.JNDIProviderAdapter
                         </attribute>
                         <!-- The combined connection factory -->
                         <attribute name="FactoryRef">XAConnectionFactory</attribute>
                         <!-- The queue connection factory -->
                         <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
                         <!-- The topic factory -->
                         <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
                         <!-- Access JMS via HAJNDI -->
                         <attribute name="Properties">
                         java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                         java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                         java.naming.provider.url=${jboss.bind.address:localhost}:1100
                         </attribute>
                         </mbean>