Connecting a Remote JMS Client to GlassFish 3

I am trying to connect to the GlassFish 3 JMS service from a stand-alone remote client. However, I get java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter. Any ideas on how to fix this?

Here is my setup:

  • Glassfish 3 JMS Service in LOCAL mode (I assume EMBEDED mode will not work in this case, because it bypasses the network stack)

  • JNDI properties are set 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

  • gf-client-module.jar (in GLASSFISH_HOME / modules) has been added to the standalone class path of the application. Also tried to add other jars present in the modules directory (e.g. jms-core.jar), but still getting the same ClassNotFoundException.

Any help would be greatly appreciated.

+6
glassfish remote-access jms
source share
4 answers

Ok I have found a solution. See here for more details, but the short answer is that I need to add two bans to the class path: imqjmsra.jar and imqbroker.jar. They were available inside rar called imqjmsra.rar, which can be found in the mc mc directory. I had to remove two cans from this wound!

+2
source share

Instead of using all the individual Glassfish jar files you may need (for example, gf-client-module.jar, imqjmsra.jar and imqbroker.jar), the preferred method is to use the gf-client.jar file. It can be found in $ GLASSFISH_HOME / lib.

More information can be found at http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB . This document is about using EJB in standalone clients, but the solution is the same for using JMS.

+3
source share

This is a complete list of client glass fish cans 3:

auto-depends.jar deployment-common.jar glassfish-corba-internal-api.jar internal-api.jar management-api.jar bean-validator.jar dol.jar glassfish-corba-newtimer.jar javax.ejb.jar orb-connector.jar common-util.jar ejb-container.jar glassfish-corba-omgapi.jar javax.jms.jar orb-iiop.jar config-api.jar ejb.security.jar glassfish-corba-orb.jar javax.resource.jar security.jar config-types.jar glassfish-api.jar glassfish-corba-orbgeneric.jar javax.servlet.jar ssl-impl.jar config.jar glassfish-corba-asm.jar glassfish-naming.jar javax.transaction.jar transaction-internal-api.jar connectors-internal-api.jar glassfish-corba-codegen.jar gmbal.jar jta.jar container-common.jar glassfish-corba-csiv2-idl.jar hk2-core.jar kernel.jar 
+1
source share

As mentioned in Ivan A Chrizzan's notes for EJB certification, and depending on the Glassfish version, this should be enough:

  • GlassFish 3 (and GlassFish 4 too, I just tested it): $ GLASSFISH_HOME / lib / gf-client.jar
  • GlassFish 2: $ GLASSFISH_HOME / lib / appserv-rt.jar and $ APS_HOME / lib / javaee.jar
0
source share

All Articles