Skip to main content

Connecting a remote client to the GlassFish JMS service

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
6 replies [Last post]
nbhatia
Offline
Joined: 2003-06-15
  1. Is there any documentation available on connecting a remote client to the GlassFish 3 JMS service? I need to know how to get an InitialContext and what jars need to be linked in. The GlassFish Application Development Guide does not cover this topic and most web references seem to be for GlassFish 2/people doing this by trial and error.
  2. Can a remote client connect to the JMS service if it is in the EMBEDED mode? i.e. Is the network stack completely bypassed in this mode? Does that mean that for a remote client to connect to the JMS service it has to be in LOCAL (or less preffered for me REMOTE) mode?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nbhatia
Offline
Joined: 2003-06-15

With a bit of help from this post, I have moved a little forward. I have set up my JNDI properties as follows:

java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl

I have also included the following jars from GLASSFISH_HOME/modules: gf-client-module.jar, jms-core.jar At this point my initialContext lookup is failing with the following exception:
java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter

Don't think this is going in the right direction. Why is the client looking for a ResourceAdapter? That's a server-side object!
Please help!

875 Guest
Offline
Joined: 2011-03-30

1. What you're doing is very similar to using the GlassFish Application
Client Container (ACC), which is fully documented. I can't help you with the
JNDI settings needed by a non-ACC client, though as you mentioned later
several people have reported his to do this. Feel free to log this as a
documentation issue in JIRA.

2. Yes, a remote client may indeed connect to the JMS service even if it is
running in EMBEDED mode. The message queue broker runs in the same JVM as the
GlassFish instance, and applications running within the GlassFish instance
will by default use a high-performance direct connection which bypasses the
network stack. However the broker will still accept remote connections just
like any message queue broker.

3. You've looked up a GlassFish JMS resource. These are dependent on a
resource adapter; by default they are configured to use the JMSRA resource
adapter (imqjmsra.rar) used to communicate with Open Message Queue. So you'll
need the resource adapter jars in your classpath .

Nigel

 

 

 

--

[Message sent by forum member 'nigeldeakin']

View Post: http://forums.java.net/node/786594

nigeldeakin
Offline
Joined: 2007-10-12

1. What you're doing is very similar to using the GlassFish Application Client Container (ACC), which is fully documented. I can't help you with the JNDI settings needed by a non-ACC client, though as you mentioned later several people have reported his to do this. Feel free to log this as a documentation issue in JIRA.
2. Yes, a remote client may indeed connect to the JMS service even if it is running in EMBEDED mode. The message queue broker runs in the same JVM as the GlassFish instance, and applications running within the GlassFish instance will by default use a high-performance direct connection which bypasses the network stack. However the broker will still accept remote connections just like any message queue broker.
3. You've looked up a GlassFish JMS resource. These are dependent on a resource adapter; by default they are configured to use the JMSRA resource adapter (imqjmsra.rar) used to communicate with Open Message Queue. So you'll need the resource adapter jars in your classpath .
Nigel

837 Guest
Offline
Joined: 2011-03-30

Thanks so much Nigel - without your help I could have never figured this out!
Everything is working fine now! I had to include imqjmsra.jar and
imqbroker.jar on my classpath.

BTW, are these jars available anywhere unbundled (a glassfish directory or a
maven repository)? I literally extracted them out of the rar.

--

[Message sent by forum member 'nbhatia']

View Post: http://forums.java.net/node/786594

nbhatia
Offline
Joined: 2003-06-15

Thanks so much Nigel - without your help I could have never figured this out! Everything is working fine now! I had to include imqjmsra.jar and imqbroker.jar on my classpath.
BTW, are these jars available anywhere unbundled (a glassfish directory or a maven repository)? I literally extracted them out of the rar.

nigeldeakin
Offline
Joined: 2007-10-12

You need to extract the JMSRA jars manually (though if you had used the application client container this would have been done for you).
Nigel