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://10.4.164.105:11099");
|
|
| 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#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...