11 Replies Latest reply on Jul 17, 2003 6:34 AM by Preeti Lovekar

    JMS in JBoss Cluster

    ranjithpillai Newbie

      Hi there,

      Somebody please answer this..

      Background: I have two JBoss instances(3.0.7) named JBoss1 and JBoss2 running in same box.

      1)Does that mean I have a JMSMQ server running in
      each JBoss instance, so totally two JMS servers in my cluster?.

      2)How about my Destinations?. Are there separate desitation in each JMS Server(local JNDI) or there is one configured in HA-JNDI? For eg: JBOSS provied Destination topic\testTopic- is it local to each JNDI or one topic\testTopic available in HA-JNDI for the cluster?.

      3)JBoss Clustering document says" partial support for JMS and MessageDrivenBeans". What does this mean?

      Thanks in advance for your help,
      Ran

        • 1. Re: JMS in JBoss Cluster
          Adrian Brock Master

          1) Yes

          2) HA-JNDI is a logical concept.
          It says look in local jndi first then search the
          jndi trees of the cluster.
          "local jndi" can also be the selected target for
          a client.

          3) There is an IL that supports failover, but
          it is pretty useless without replication.

          Regards,
          Adrian

          • 2. Re: JMS in JBoss Cluster
            ranjithpillai Newbie

            Hi there,

            Thanks for your reply.
            Still I have few more questions. Please answer these too.

            1) Since I have seperate JMS server running in each JBoss instance in one cluster, does that mean the same Destination is also replicated in local JNDI tree?

            for eg: if I am using Topic/testTopic destination, does that mean Topic/testTopic is replicated in each JBoss local JNDI?

            2) If I have an MDB deployed in this cluster, how does this MDB behave if this MDB subscribe to Topic/testTopic? I have deployed MDB in all JBoss instances in cluster.

            3) In my cluster JBoss instances are named JBoss1 and JBoss2. My MDB is deployed in JBoss1 as well as JBoss2. When a publisher publishes a message to Topic/testTopic in JBoss1, does MDB deployed in JBoss1 as well as JBoss2 recieve the same message or just MDB deployed in JBoss1 receive the message?

            My aim: What I am trying to achieve is broadcasting a message. So when a publisher publishes a message, MDB deployed in each instance(in one cluster) should receive the same message. The problem which I am facing now is when I am publishing a message ,only one MDB is receiving the message, not both.

            Thanks in advance for your help,
            Ran.

            • 3. Re: JMS in JBoss Cluster
              Adrian Brock Master

              This should work if you have the topic on one server
              and then deploy the MDB on each server to
              subscribe to that one topic.

              NOTE: Which one you connect to is controlled
              by the JMSProviderAdaptorJNDI setting in jboss.xml
              which is an MBean bound into jndi.
              You can see the default one at the top of
              jms-service.xml/jms-ds.xml

              Regards,
              Adrian

              • 4. Re: JMS in JBoss Cluster
                ranjithpillai Newbie

                Hi there,

                Thanks for your help.
                Ran

                • 5. Re: JMS in JBoss Cluster
                  vakrishnan Newbie

                  Hi,

                  I am running two instances of JBoss 3.2 on my machine. I created a topic on A and deployed the MDB on A and B. On B's startup though, it notices the missing topic and creates a temporarty Destination. Is this the default behaviour? Is there a way to override this behaviour?

                  What I was hoping to achieve was to make B lookup the topic created on A.

                  Could someone please help me out?

                  Ranjit, if you have got it working for you, could you mention the procedure you followed?

                  Thanks in advance,
                  vakrishnan.

                  • 6. Re: JMS in JBoss Cluster
                    Adrian Brock Master

                    You need to provide a provider adaptor
                    that points to the remote topic.

                    The default one at the top of jms-ds.xml,
                    doesn't specify the ProviderUrl attribute
                    so it defaults to local host.

                    You can override the provider adaptor
                    per mdb in jboss.xml or change it globally
                    in jms-ds.xml

                    Another approach is to use the external context
                    mbean to bring part of B's jndi into A's jndi.

                    Regards,
                    Adrian

                    • 7. Re: JMS in JBoss Cluster
                      vakrishnan Newbie

                      Adrian, thanks for the reply, I did exactly as you advised, but I still can't get it to work the way I want. I have included snippetes of my configuration below.

                      Custom JMSProvider definition in jms-ds.xml(Identical for both A and B):
                      --START

                      RemoteJMSProvider

                      org.jboss.jms.jndi.JBossMQProvider

                      java:/XAConnectionFactory
                      java:/XAConnectionFactory
                      192.168.1.240:1099

                      --END

                      Container definition in jboss.xml(Identical for both A and B):
                      --START
                      <container-configuration extends="Standard Message Driven Bean">
                      <container-name>dbsRemoteTopicContainer</container-name>
                      <container-pool-conf>
                      3
                      true
                      </container-pool-conf>
                      <container-invoker-conf>
                      RemoteJMSProvider
                      StdJMSPool
                      </container-invoker-conf>
                      </container-configuration>
                      --END

                      Topic conf in jboss.xml A (Only the jndi-name is different):
                      --START
                      <message-driven>
                      <ejb-name>ConfigMDB</ejb-name>
                      <destination-jndi-name>topic/ConfigurationTopic</destination-jndi-name>
                      <jndi-name>ConfigMDB</jndi-name>
                      <configuration-name>dbsRemoteTopicContainer</configuration-name>
                      </message-driven>
                      --END

                      Topic conf in jboss.xml B (Only the jndi-name is different):
                      --START
                      <message-driven>
                      <ejb-name>ConfigMDB</ejb-name>
                      <destination-jndi-name>topic/ConfigurationTopic</destination-jndi-name>
                      <jndi-name>ConfigMDB1</jndi-name>
                      <configuration-name>dbsRemoteTopicContainer</configuration-name>
                      </message-driven>
                      --END

                      The topic is not deployed on B, and the server creates a temporary topic on startup.
                      I have included bits of B's startup trace that I thought were relavent:

                      --START
                      ...
                      ...
                      01:19:59,262 INFO [JMSProviderLoader] Bound adapter to java:/RemoteJMSProvider
                      01:19:59,262 INFO [JMSProviderLoader] Started
                      ...
                      ...
                      01:21:36,183 WARN [JMSContainerInvoker] destination not found: topic/Configurat
                      ionTopic reason: javax.naming.NameNotFoundException: ConfigurationTopic not boun
                      d
                      01:21:36,183 WARN [JMSContainerInvoker] creating a new temporary destination: t
                      opic/ConfigurationTopic
                      01:21:36,193 INFO [ConfigurationTopic] Creating
                      01:21:36,193 INFO [ConfigurationTopic] Created
                      01:21:36,203 INFO [ConfigurationTopic] Starting
                      01:21:36,203 INFO [ConfigurationTopic] Bound to JNDI name: topic/ConfigurationT
                      opic
                      01:21:36,203 INFO [ConfigurationTopic] Started
                      ...
                      ...
                      --END

                      With the above configuration it behaves like a clustered topic. Both the servers are sent the messages, but NOT the same messages. A message sent to A is not sent to B and vice-versa.

                      I also get the following trace the first time B gets a message (But never afterwards):
                      --START
                      01:24:57,446 WARN [ClassLoadingTask] Duplicate class found: org.apache.log4j.ne
                      t.JMSAppender
                      Current CS: (file:/D:/Tools/ApplicationServers/jboss-3.2.0/server/all3/tmp/deplo
                      y/server/all3/deploy/dbs.ear/41.dbs.ear-contents/log4j.jar <no certificates>)
                      Duplicate CS: (file:/D:/Tools/ApplicationServers/jboss-3.2.0/server/all3/lib/log
                      4j.jar <no certificates>)
                      --END

                      Any ideas?

                      -vakrishnan

                      • 8. Re: JMS in JBoss Cluster
                        Adrian Brock Master

                        Hi,

                        You cannot use java:/XAConnectionFactory
                        from a different jboss instance, you will have to
                        choose a remove connection factory like
                        XAConnectionFactory.

                        Does the topic exist on the remote machine?

                        Finally, you are trying to use redeploy log4j
                        when it already exists inside jboss.

                        Regards,
                        Adrian

                        • 9. Re: JMS in JBoss Cluster
                          vakrishnan Newbie

                          Adrian, thanks for your time.

                          I tried using
                          XAConnectionFactory,
                          RMIXAConnectionFactory and
                          RMIConnectionFactory,
                          but I see the same behaviour in all cases. A message is sent to only one subscriber.

                          The topic does exist on the remote machine.

                          -vakrishnan.

                          • 10. Re: JMS in JBoss Cluster
                            vakrishnan Newbie

                            Forget it, I finally got it to work. The temporary topic created on the second server 'B' was killing me. The topics were being load balanced and the messages were being split across the two topics.

                            I could not get the subscriber on B to listen on the topic on A. The real problem was that the configuration in JBoss 3.1/3.2 is vastly different from that of earlier versions of JBoss.

                            In 3.2 specifing a new <container-configuration> does not help. I had to specify a <invoker-proxy-binding> referring to my custom provider in standard-jboss.xml and refer to it in jboss.xml.

                            Just in case anybody runs into the same problem I did, here are the configuration snippets:

                            standard-jboss.xml
                            --START
                            <invoker-proxy-binding>
                            remoted-message-driven-bean
                            <invoker-mbean>default</invoker-mbean>
                            <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
                            <proxy-factory-config>
                            RemoteJMSProvider
                            StdJMSPool
                            15
                            1
                            True

                            10

                            queue/DLQ
                            10
                            0


                            </proxy-factory-config>
                            </invoker-proxy-binding>
                            --END

                            jboss.xml
                            --START
                            <message-driven>
                            <ejb-name>ConfigMDB</ejb-name>
                            <jndi-name>ConfigMDB</jndi-name>
                            <destination-jndi-name>topic/ConfigurationTopic</destination-jndi-name>
                            <invoker-bindings>
                            <invoker-proxy-binding-name>remoted-message-driven-bean</invoker-proxy-binding-name>
                            <jndi-name>ConfigMDB</jndi-name>
                            </invoker-bindings>
                            </message-driven>
                            --END

                            -vakrishnan

                            • 11. Re: JMS in JBoss Cluster
                              Preeti Lovekar Newbie

                              I use jboss 3.0.4 and need to implement a broadcast mechanism. Following the chain of discussions above, I have tried to create a MDB deployed on all the servers in the cluster and a topic on one server to which the MDBs subscribe. The configurations ( for all servers ) are as follows :
                              1. created a topic in my jbossmq-destinations-service.xml

                              <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
                              <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager


                              2. in jms-service.xml

                              RemoteJMSProvider

                              org.jboss.jms.jndi.JBossMQProvider
                              XAConnectionFactory
                              XAConnectionFactory
                              192.168.0.1:1099


                              3. - added the following in my jboss.xml
                              <message-driven>
                              <ejb-name>CacheUpdateMDB</ejb-name>
                              <destination-jndi-name>topic/cacheTopic</destination-jndi-name>
                              <resource-ref>
                              <res-ref-name>jms/TCF</res-ref-name>
                              <jndi-name>TopicConnectionFactory</jndi-name>
                              </resource-ref>
                              </message-driven>

                              4. changed the following in jboss-service.xml
                              jboss.mq:service=JMSProviderLoader,name=JBossMQProvider to
                              jboss.mq:service=JMSProviderLoader,name=RemoteMQProvider

                              5. changed the following in the container configuration for Message Driven Bean in standardjboss.xml
                              DefaultJMSProvider to
                              RemoteJMSProvider

                              But I get the following errors when I start jboss :
                              2003-07-17 14:31:40,250 INFO [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Starting
                              2003-07-17 14:31:40,265 INFO [org.jboss.ejb.plugins.jms.DLQHandler] Creating
                              2003-07-17 14:31:40,812 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
                              javax.jms.IllegalStateException: SecurityManager only works with a SubjectSecurityManager
                              at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:185)
                              at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:40)
                              at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:589)
                              at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
                              at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:328)
                              at java.lang.Thread.run(Thread.java:536)
                              2003-07-17 14:31:40,843 ERROR [org.jboss.ejb.plugins.jms.DLQHandler] Initialization failed
                              javax.jms.IllegalStateException: SecurityManager only works with a SubjectSecurityManager
                              at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:185)
                              at
                              org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:40).......

                              2003-07-17 14:31:40,859 ERROR [org.jboss.ejb.plugins.jms.DLQHandler] Starting failed
                              java.lang.NullPointerException
                              at org.jboss.ejb.plugins.jms.DLQHandler.startService(DLQHandler.java:138)
                              at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)........

                              2003-07-17 14:31:40,859 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Starting failed
                              java.lang.NullPointerException
                              at org.jboss.ejb.plugins.jms.DLQHandler.startService(DLQHandler.java:138)
                              at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)........

                              2003-07-17 14:31:40,875 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=local/CacheUpdateMDB,service=EJB
                              java.lang.NullPointerException
                              at org.jboss.ejb.plugins.jms.DLQHandler.startService(DLQHandler.java:138)
                              at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165).........

                              2003-07-17 14:31:41,156 WARN [org.jboss.ejb.plugins.jms.JMSContainerInvoker] JMS provider failure detected:
                              javax.jms.IllegalStateException: SecurityManager only works with a SubjectSecurityManager
                              at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:185)

                              Could anyone please help ? Thanks.
                              - Preeti