2 Replies Latest reply on Feb 10, 2005 5:20 PM by adrian.brock

    Remote Producers

    vlewis

      I am using JBoss 4.0.1 on Win2k with J2SE 1.4.2.

      I have read the FAQ, Read Me First and Read Me Second. I have also searched this and other forums but have been unable to figure out what I am doing wrong.

      I have MDB which consumes messages from one queue and produce messages for another. While I am able to get the MDBs to consume off a remote queue they are unable to find the remote queues to which I wish to publish.

      What I have done:

      Added the following to my jms-ds.xml on the remote host:

       <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
       name="jboss.mq:service=JMSProviderLoader,name=PromJMSProvider,server=devserver3a">
       <attribute name="ProviderName">PromJMSProvider</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>
       <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=devserver3a:1099
       </attribute>
       </mbean>
      
       <tx-connection-factory>
       <jndi-name>PromJmsXA</jndi-name>
       <xa-transaction/>
       <rar-name>jms-ra.rar</rar-name>
       <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
       <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/PromJMSProvider</config-property>
       <max-pool-size>20</max-pool-size>
       <security-domain-and-application>PromJmsXARealm</security-domain-and-application>
       </tx-connection-factory>
      


      Added this to my login-config.xml on the remote host:

       <application-policy name = "PromJmsXARealm">
       <authentication>
       <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
       flag = "required">
       <module-option name = "principal">guest</module-option>
       <module-option name = "userName">guest</module-option>
       <module-option name = "password">guest</module-option>
       <module-option name = "managedConnectionFactoryName">jboss.jca:service=TxCM,name=PromJmsXA</module-option>
       </login-module>
       </authentication>
       </application-policy>
      
      


      As I mentioned the MDBs are receiving messages from the remote queues but for completeness here is the change I made to message-driven-bean (I want all MDBs on this server to use remote queues):
       <invoker-proxy-binding>
       <name>message-driven-bean</name>
       <invoker-mbean>default</invoker-mbean>
       <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
       <proxy-factory-config>
       <JMSProviderAdapterJNDI>PromJMSProvider</JMSProviderAdapterJNDI>
       <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
       <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
       <MinimumSize>1</MinimumSize>
       <MaximumSize>15</MaximumSize>
       <KeepAliveMillis>30000</KeepAliveMillis>
       <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>
      


      Here is the jboss.xml for one of the remote MDBs

       <message-driven>
       <ejb-name>FileIDFP</ejb-name>
       <destination-jndi-name>queue/FileId</destination-jndi-name>
       <resource-ref>
       <res-ref-name>jms/ConnectionFactory</res-ref-name>
       <jndi-name>java:/PromJmsXA</jndi-name>
       </resource-ref>
       <resource-env-ref>
       <resource-env-ref-name>jms/Answers</resource-env-ref-name>
       <jndi-name>queue/JobsAnswers</jndi-name>
       </resource-env-ref>
       </message-driven>
      


      I then get this exception:

      javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: JobsAnswers not bound]
      


      on the line in which I attempt to get the destination I whish to send messages to:

      Destination destination = (Destination)jndiContext.lookup("java:comp/env/jms/Answers");
      


      I am really at a loss as to what to try next. Might someone please help.

      Thank You,
      Victor

        • 1. Re: Remote Producers

          It is not surpising you couldn't find anything in the JMS FAQ or WIKI.
          This is not a JMS Question, it is an EJB/jndi question.

          Is your queue deployed locally? I think not.

          Try:

          <jndi-name>jnp://devserver3a:1099/queue/JobsAnswers</jndi-name>
          


          The resource-ref knows nothing about the JMSProvider.
          The JMSProvider is used to configure the jms resource adaptor and mdb inbound processing.
          A resource-ref is used to configure generic jndi references.

          Since it is remote, you must provide the full url.

          Please also read the manual about the Naming MBeans that JBoss provides
          to allow jndi federation, and the naming documentation in general

          Feel free to write up a simple example on the WIKI.

          • 2. Re: Remote Producers

            Perhaps you would care to have a go at implementing
            this simplified version of the ExternalContext mbean that is
            targetted towards your use case?
            http://jira.jboss.com/jira/browse/JBAS-1450