[jboss-user] [JBoss Messaging Users] - Re: Easiest way to bind IBM WS MQ hosted 'Queue' to name in

ben.cotton@rutgers.edu do-not-reply at jboss.com
Fri Sep 18 15:00:17 EDT 2009

I have successfully deployed and executed  IBM's WSMQ JCA Resource Installation and Verification Test application (wmq.jmsra.ivt.ear) on my JBoss 5.1 AS instance.  

The IVT app  establishes on my JBoss instance a Resource-->ConnectionFactory-->TxConnectionFactory named 'IVTCF' that is visible from my JBoss 5 Admin console.  Running the IVT app's Servlet example confirms that JMS code referencing the 'IVTCF' correctly uses the configured JCA adapter to produce a Message on an IBM WS MQ hosted Queue.  Running the IVT app's MDB example confirms that I can also consume Messages from the exact same IBM WS MQ Queue. 

Unfortunately, I don't have the IVT.ear .java source code so I don't have an explicit example of how this is achieved with explicit JMS code.  I tried to execute the following producer, using the same 'IVTCF' TxConnectionFactory, but the runtime value of the 'factory' assignment always NULL.  And thus the last line of this code is always an NPE.

  | Properties props = new Properties();
  | 			props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); 
  | 			props.setProperty(Context.PROVIDER_URL,"jnp://");   
  | 			Context ctx = new InitialContext(props);
  | 			javax.jms.ConnectionFactory factory = (javax.jms.ConnectionFactory)ctx.lookup("IVTCF"); 
  |                         // 'factory' always value =  NULL at his time, why?
  | 			System.out.println("'IVTCF' ConnectionFactory established! IVTCF=["+factory+"]"); 
  |                         //NPE
  | 			Connection conn = factory.createConnection(); 

This code is using the exact same 'IVTCF' ConnectionFactory used by the IVT.ear servlet and MDB (both of which run successfully).

Any suggestions on what might be wrong with the above code segment?

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

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

More information about the jboss-user mailing list