Connect to a remote server JMS resources

Hi all,

From a WebSphere server J2EE application, I am trying to connect to a remote WebSphere server JMS resources, in order to send a message to the remote server.

I have tried:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");

env.put(Context.PROVIDER_URL, "iiop://localhost:2811");

InitialContext initialContext = new InitialContext(env);

queueConnectionFactory = (QueueConnectionFactory) initialContext.lookup("jms/QueueRemote");

but it fails with org.omg.CosNaming.NamingContextPackage.NotFound exception.

The JNDI name is correct.

Please, advice me what to do? Or do you know some other approach?

[735 byte] By [pamira] at [2007-11-26 17:54:33]
# 1
Hope ur webshpere jar file is set in the classpath..regardsShanu
mshanua at 2007-7-9 5:07:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Hi Shanu,I am running this from inside the WebSphere, so I think that all libraries are in the classpath.
pamira at 2007-7-9 5:07:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
See that The JOnAS's client.jar library must also be added to the classpath for WebSphere MQ. If the jar file is not set in the classpath set it..pls cross check..regardsShanu
mshanua at 2007-7-9 5:07:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

I have solved the problem!

The core of the problem proved to be a bug in the WebSphere: when you have two WAS servers on one host, the context factory always looks up in its home server.

However, I have found a workaround - I am looking up a local connection factory, which sends a queue to a remote destination, located at the remote server's Service Integration Bus.

Regards

pamira at 2007-7-9 5:07:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
Hi,I am also facing the same problem in my application. I am also using WebSphere Application server v6.0.2.11.Can you please share the workaround or the solution with me?Thanks & Regards,Sandip
sandipdesalea at 2007-7-9 5:07:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...