users@glassfish.java.net

Re: Sending JMS to a Remote GlassFish Server problems

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 May 2008 06:56:05 PDT

I've found out a lot more about this problem. If you go through the source of S1ASCtxFactory, you can see it doesn't look at the ORB properties. There is another factory class, "com.sun.enterprise.naming.SerialInitContext" that wraps S1ASCtxFactory, and it looks like pretty much all it does it check the ORB properties and use them if they are set.

So, if you use SerialInitContext it works. Great news, right? Wrong...

Now the problem is that it somewhere caches those settings, so you can only set them one time in that JVM instance. If you change them after using them the first time, the new property values will never get used.

What I've resorted to doing is probably what the designers intended. Create a local conn factory to use for remote connections, such as "jms/remote/ConnFactory" and set the "AddressList" property to the remote servers host:port (you can have a list. Check the docs for the conn factory properties)

Create a JMS Resource (JNDI mapping only, dont bother creating a JMS Dest) that matches the JNDI on the remote server, i.e.:

Server B (Remote)
jms_destA (JMS dest)
jms/destA (JNDI resource)

ServerA (Local)
jms/remote/ConnFactory (w/ AddressList property set for the ServerB imq server)
jms/destA JNDI (but no jms dest created)

Now when you lookup jms/destA with jms/remote/ConnFactory on ServerA, it will lookup the remote server.

However, if the remote server in unavailable... it will auto-create a jms dest based on its normal rules and send messages to the local queue :(

Thats the best i've been able to come up with...
[Message sent by forum member 'asherwin' (asherwin)]

http://forums.java.net/jive/thread.jspa?messageID=274846