4 Replies Latest reply on May 31, 2006 7:00 PM by rob.hadfield

    Can't configure an MDB to a remote destination

    rob.hadfield

      I've been trying to configure a simple MDB to use a remote destination as described in this wiki page -> http://wiki.jboss.org/wiki/Wiki.jsp?page=HowDoIConfigureAnMDBToTalkToARemoteQueue
      I can see the naming lookup done on port 1099 to the remote server, but then the MDB is bound to a local destination of the same name, or if I remove this queue from the local configuration, I get

      2006-05-31 12:04:30,091 WARN [org.jboss.ejb.plugins.jms.JMSContainerInvoker] JMS provider failure detected for RemoteQueue
      org.jboss.deployment.DeploymentException: Error during queue setup; - nested throwable: (javax.jms.InvalidDestinationException: The destination QUEUE.RemoteQueue does not exist !)

      The remote queue is set up and has messages ready to deliver; There just seems to be a missing link somewhere. The wiki page mentioned above only references the queuehost in the JNDI lookup. Is is really that simple? Why won't it work for me!

      I've tried this with 4.0.2 and 4.0.4. The MDB works fine when configured for a local queue. Does anyone have a working example of remote mdb that they can share, or a moment to enlighten me as to what I've missed out?

        • 1. Re: Can't configure an MDB to a remote destination
          jaikiran

          Well i do have it working without any issues. In my case the remote queue is named queueOn2177 and is deployed on the remote server using the following entry in jbossmq-destinations-service.xml file:

          <mbean code="org.jboss.mq.server.jmx.Queue"
           name="jboss.mq.destination:service=Queue,name=queueOn2177">
           <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
           </mbean>


          Then on my local machine, i have configured my MDB to look up this remote queue, by configuring the same in 3 files, namely ejb-jar.xml, jboss.xml and jms-ds.xml as follows:

          jboss.xml:

          <message-driven>
           <ejb-name>SomeMDB</ejb-name>
           <destination-jndi-name>queue/queueOn2177</destination-jndi-name>
           <invoker-bindings>
           <invoker>
           <invoker-proxy-binding-name>MyMDBInvoker</invoker-proxy-binding-name>
           </invoker>
           </invoker-bindings>
          
          
           </message-driven>
          


          <invoker-proxy-bindings>
           <invoker-proxy-binding>
           <name>MyMDBInvoker</name>
           <invoker-mbean>SomeMDB</invoker-mbean>
           <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
           <proxy-factory-config>
           <JMSProviderAdapterJNDI>MyJMSProvider</JMSProviderAdapterJNDI>
           <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
           <MinimumSize>1</MinimumSize>
           <KeepAliveMillis>30000</KeepAliveMillis>
           <MaximumSize>15</MaximumSize>
           <MaxMessages>1</MaxMessages>
           <MDBConfig>
           <ReconnectIntervalSec>10</ReconnectIntervalSec>
           <DLQConfig>
           <DestinationQueue>queue/DLQ</DestinationQueue>
           <MaxTimesRedelivered>10</MaxTimesRedelivered>
           <TimeToLive>0</TimeToLive>
           </DLQConfig>
           </MDBConfig>
           </proxy-factory-config>
           </invoker-proxy-binding>
           </invoker-proxy-bindings>


          jms-ds.xml:

          <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
           name="jboss.mq:service=JMSProviderLoader,name=RemoteMQProvider,server=ps2177">
           <!--this name will be used in jboss.xml-->
           <attribute name="ProviderName">MyJMSProvider</attribute>
           <!--Points to remote server-->
           <attribute name="ProviderUrl">jnp://ps2177:1099</attribute>
           <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
           <attribute name="QueueFactoryRef">UIL2XAConnectionFactory</attribute>
           <attribute name="TopicFactoryRef">UIL2XAConnectionFactory</attribute>
           </mbean>
          


          ejb-jar.xml:

          <message-driven>
           <ejb-name>SomeMDB</ejb-name>
           <ejb-class>mypackage.myClass</ejb-class>
           <transaction-type>Container</transaction-type>
           <message-driven-destination>
           <destination-type>javax.jms.Queue</destination-type>
           </message-driven-destination>
          
           </message-driven>




          • 2. Re: Can't configure an MDB to a remote destination
            obn

            where do you put those three files? in the META-INF directory of the project?
            my problem is that my mdb does not listen to incoming messages,
            so maybe i forgot a descriptive file like yours so that it is not deployed correctly.

            config:
            - jboss 4.0.4GA
            - jboss-messaging-1.0.1.CR2
            - jboss-EJB-3.0_RC6-PFD

            when i deploy the mdb example i'm able to connect and send messages from a remote system, they're processed by the MDBExample mdb.

            • 3. Re: Can't configure an MDB to a remote destination
              rob.hadfield

              Thanks jaikiran, I solved the problem although I'm not happy about it! In my jms-ds.xml I had specified:

              <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>

              which is how the DefaultJMSProvider is configured. When I changed this to

              <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>


              as in your post, it magically works! So I don't understand why these references should be different.

              I rechecked server.log (trace is enabled for org.jboss.jms) but there was no indication of a problem with the reference.

              Nevertheless my remote MDB now works which is a *great* relief... 8-) Thanks again.

              • 4. Re: Can't configure an MDB to a remote destination
                rob.hadfield

                Hi obn,

                In my configuration my ejb jar file looks like this:

                com/mycompany/mypackage/mbdclassfile.class
                meta-inf/ejb-jar.xml
                meta-inf/jboss.xml

                jms-ds.xml is in your JBossHome/server/*configuration*/deploy/jms

                It sounds like you have another MDB (MDBExample) listening to the same queue...