1 Reply Latest reply on Mar 16, 2009 11:29 AM by Adrian Brock

    Connecting a remote queue (oc4j server) in JBoss

    Romain Reschke Newbie

      Dear all,

      I've created a queue in oc4j, I can post and read messages and receive it via a Java Client.

      Now I want to create a MDB in Jboss to consume these messages.
      I've followed this Jboss tutorial

      http://www.jboss.org/community/docs/DOC-9893/version/5

      All is deployed, but the messages are not consumed : no logs, no exceptions...
      I don't understand 1 thing : in these examples, I've not documented the JNDI of the oc4j queue, how can I set it ? (queue/myqueue)


      In the jms.ds-xml of Jboss, I've created

      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
      name="jboss.mq:service=JMSProviderLoader,name=RemoteJBossMQProvider">
      <attribute name="ProviderName">RosyStatJMSProvider</attribute>
      <attribute name="ProviderAdapterClass">
      org.jboss.jms.jndi.JNDIProviderAdapter
      </attribute>
      <attribute name="FactoryRef">XAConnectionFactory</attribute>
      <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
      <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
      <attribute name="Properties">
      java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory
      java.naming.provider.url=ormi://myoc4jserver:12502/
      java.naming.security.principal=login
      java.naming.security.credentials=password
      </attribute>
      </mbean>
      


      And this is the Jboss.xml of my MDB
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss>
       <enterprise-beans>
       <message-driven>
       <ejb-name>MyMDB</ejb-name>
       <destination-jndi-name>queue/MDBReceiveQueue</destination-jndi-name>
       <invoker-bindings>
       <invoker>
       <invoker-proxy-binding-name>whatever-message-driven-bean</invoker-proxy-binding-name>
       </invoker>
       </invoker-bindings>
       </message-driven>
       </enterprise-beans>
      
       <invoker-proxy-bindings>
       <name>whatever-message-driven-bean</name>
       <proxy-factory-config>
       <JMSProviderAdapterJNDI>java://RosyStatJMSProvider</JMSProviderAdapterJNDI>
       <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
       <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-bindings>
      </jboss>




      Here is my client which connects to the oc4j server (and works)
      Properties properties = new Properties();
       try {
       properties.load(new FileInputStream(config));
       } catch (Exception e) {
       throw new RuntimeException("Error while reading property file.", e);
       }
       Context ctx;
      
       try {
       Properties parm = new Properties();
      
       parm.setProperty("java.naming.factory.initial",
       "com.evermind.server.rmi.RMIInitialContextFactory");
       parm.setProperty("java.naming.provider.url", "ormi://myoc4jserver:12502");
       parm.setProperty("java.naming.security.principal", "login");
       parm.setProperty("java.naming.security.credentials", "password");
      
       ctx = new InitialContext(parm);
      
       QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx
       .lookup("jms/QueueConnectionFactory");
      
       connection = connectionFactory.createQueueConnection();
       connection.start();
       session = connection.createQueueSession(false,
       Session.AUTO_ACKNOWLEDGE);
       queue = (Queue) ctx.lookup(properties.getProperty("queue/myqueue"));