[jboss-user] [JBoss Messaging Users] - Re: Easiest way to bind IBM WS MQ hosted 'Queue' to name in
do-not-reply at jboss.com
Mon Sep 21 14:37:31 EDT 2009
FYI, I have a reasonably manageable workaround (though not ideal).
When I code the exact same .lookup() logic from a JBoss-deployed servlet (instead of from an external app), everything works perfectly. This is obviously because the internal InitialContext construction needs no Context.XXX properties set.
| InitialContext ic = new InitialContext(); // no Context.XXX props!! Now everything works via JCA!
| javax.jms.ConnectionFactory cf = (javax.jms.ConnectionFactory) ic.lookup("IVTCF");
| // confirm that we found the CF
| log.info("'IVTCF' javax.jms.ConnectionFactory found: [" + cf + "]");
| // get the queue
| Queue q = (Queue) ic.lookup("IVTQueue");
| // confirm that we found the queue
| log.info("'IVTQueue' javax.jms.Queue found: [" + q +"]");
Now the 'cf' value is NON-NULL and I can indeed publish to an IBM WS MQ destination from a JBoss component just by looking up a Resource-->ConnectionFactory ... and then relying on the JCA resource adapter to transparently manage all the messaging plumbing. :-)
I still can't do this from an external stand-alone application that parameterizes its JBoss InitialContext() construction with Properties, but I'll live with that for now (or maybe post the issue to a JNDI focused forum).
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256242#4256242
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256242
More information about the jboss-user