4 Replies Latest reply on Feb 7, 2005 3:05 AM by Luis Urueña

    MDB in a cluster talking with a remote queue on other cluste

    Luis Urueña Newbie

      Hi all!

      I have a cluster with two instances on the same computer, and a JbossMQ HASingleton configured in one of the nodes. This JbossMQ instance does management of one test queue called test/testQueue. On the other hand I have a client which sends JMS messages to the queue (it's working properly by means of HAJNDI), and a MDB receiving those messages.

      After I've read the wiki "HowDoIConfigureAnMDBToTalkToARemoteQueue" I decided to use JNDIProviderAdapter class for access cluster with a remote Jms provider, through HAJNDI too (like sender client). So, I configured this jms provider, the invoker-proxy-binding and the MDB following wiki's advices.

      This is the code of the Jms provider (HAJNDI)

       <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=remotecluster">
       <attribute name="ProviderName">RemoteClusterJMSProvider</attribute>
       <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
       <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
       <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
       <attribute name="Properties">

      Once I'm running this example, I get an timeout exception because can't connect to the remote HAJNDI port. The cause is:

      Failed to retrieve stub from server

      t seems like the request to is not an HAJNDI client request, even jms provider has HAJNDI configuration. And exactly, if I change port 1100 to 1099 (JNDI port) all the system runs correctly. So...

      What's the problem in this example?
      What I cannot access to a queue on remote cluster from a MDB with HAJNDI?
      Does anybody know how can I do it?

      My best regards,

        • 1. Re: MDB in a cluster talking with a remote queue on other cl
          Luis Urueña Newbie


          Now I'm testing (with Jboss 4.0.1) another configuration. In one computer have a cluster of two instances, which has the JBossMQ HASingleton server. Now in the other computer there are another cluster of two instances with the MDBs. These MDBs are bound by means of a RemoteJMSProvider like in the previous post.

          When I test this system, I get another different exception.

          javax.jms.JMSException: Error creating the dlq connection: XAConnectionFactory

          After testing the example of the first post, and this recent example, I take some conclusions:

          1) If the JNDIProviderAdapter is configured for url provider for JNDI with (i.e., the configuration runs properly

          2) However, if is configured for url provider for HAJNDI (i.e., the server lookups in the local host, regardless the HAJNDI host specifIED.

          Is this correct, or I'm doing something wrong?
          And the same question, how can I configure the server so that the MDBs can access the remote queue, placed in a cluster, with HAJNDI?

          • 2. Re: MDB in a cluster talking with a remote queue on other cl
            xavierpayne2 Newbie

            I don't know if this will help but you could try explicitly defining the context settings like this:

            Hashtable contextSettings = new Hashtable();
             contextSettings.put("jnp.disableDiscovery", "true");
             contextSettings.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

            Change the ip address to whatever the ip is of your remote queue
            and then just use this "contextSettings" hashmap in the constructor when you create your InitialContext object you'll use for the lookup.

            The jnp.disableDiscovery = true tells the context loader to only try to resolve using the IP provided (instead of the default behavior which is to try attempt to discover and use any valid ip in the cluster).

            Hope this helps.

            • 3. Re: MDB in a cluster talking with a remote queue on other cl
              Luis Urueña Newbie

              Hi all !

              Thanks DashV for your reply. I've tried your solution, and the JMS provider was forced to connect to the ports of the cluster nodes. However the error persists even JMS Provider are accessing to correct cluster nodes.

              javax.jms.JMSException: Error creating the dlq connection: Could not obtain connection to any of these urls:,

              and the root error is

              javax.naming.CommunicationException: Failed to retrieve stub from server [Root exception is java.io.StreamCorruptedException: unexpected block data]

              Next I attach configuration of the JMS Provider, the standardjboss.xml and the jboss.xml portion of the MDB configuration. All these files are related to the jboss server that access to the remote cluster, and contains the MDBs.

              JMS provider configuration in jms-ds.xml

               <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
               <attribute name="ProviderName">RemoteJMSProvider</attribute>
               <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
               <!-- The queue connection factory -->
               <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
               <!-- The topic factory -->
               <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
               <!-- Connect to HAJNDI on the host whatever -->
               <attribute name="Properties">

              Remote proxy invoker binding configuration at standardjboss.xml


              Finally, the MDB configuration at jboss.xml


              I wish that anybody could help me


              • 4. Re: MDB in a cluster talking with a remote queue on other cl
                Luis Urueña Newbie

                Has anybody tried a similar configuration?
                One cluster with JMS High Availabilty in one of them, and MDBs trying to receive messages through HAJNDI.
                Any help will be appreciated.