[jboss-user] [JBoss Messaging] - Problem sending message from container using Managed connect

cresny do-not-reply at jboss.com
Mon Apr 9 14:04:58 EDT 2007


We have a JBoss 4.0.5.GA server instance (server A) communicating with a non-clustered JBoss Messaging instance (server B) via scoped deployment and modified JCA datasource descriptor as outlined in:

http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMessagingUser_Enabling_access_to_remote_JBoss_Messaging_instance

All MDBs in server A deploy and pick up messages fine. The problem we have is in sending messages from Server A using a managed connection factory. 

With the following code, messages appear to be sent but do not show up in the destination:

          InitialContext ic = new InitialContext();
          cf = (ConnectionFactory)ic.lookup("java:/JmsXA");          
          Connection connection = cf.createConnection();
          connection.start();
          Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
          ic.close();
          Queue queue = session.createQueue("testQueue");          
          producer = session.createProducer(queue);
          tm = session.createTextMessage(txt);          
          producer.send(tm);          

If we tail the log on server B (JBM), we do see the session.start() as well as session.close() on subsequent runs. I assume the session is being cached. However, even though there are no errors, we see no messages in the queue.

The same code *will* send messages properly if we get the ConnectionFactory with a hack:

         InitialContext ic = new InitialContext();
          Object object = ic.lookup("java:/DefaultJMSProvider");          
          ic.close();          
          InitialContext ic2 = (InitialContext)object.getClass().getMethod("getInitialContext", null).invoke(object, null);          
    	  ConnectionFactory cf =  (ConnectionFactory) ic2.lookup("XAConnectionFactory");    	  
          ic2.close();

Is there a way to send messages from within the container with a managed connection factory?












View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035775#4035775

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035775



More information about the jboss-user mailing list