users@glassfish.java.net

Re: Using the Generic JMS RA with GlassFish 3.1 & Custom JMS connection factory classes

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Thu, 14 Apr 2011 10:29:56 +0100

On 13/04/2011 23:33, forums_at_java.net wrote:
> I have a need to use the Generic JMS RA to load my own connection factory
> classes, which in turn delegate back to OpenMQ. If I configure the generic
> RA to use OpenMQ directly, things work fine and I'm able to get a
> connection. However, once I substitute my class names into the
> configuration I am unable to obtain a connection unless I put imq.jaq and
> jms.jar to the glassfish/lib directory along wth my jar file but this breaks
> the Glassfish JMS service. I'm fairly sure that this is some sort of class
> loading issue - I currently deploy the generic jms RA as a separate
> application and am wondering if I could bundle the other jars with it in an
> EAR or something like this fellow did for ActiveMQ:

Yes, if you want to use GenericJMSRA to connect to a JMS provider other than MQ (which is effectively what you have done
by adding your own wrapper classes) you need to make its classes available to the appropriate class loader.

The simplest way to do this is to copy the relevant jar to glassfish/lib (this is the documented recommendation in the
GenericJMSRA documentation).

You can also define an "application-specific class library" when you deploy your application, using the --libraries
option in "asadmin deploy". For more information, read the section "Application-Specific Class Loading" in the GlassFish
Server Open Source Edition 3.1 Application Development Guide, which you can find at http://glassfish.java.net/docs/

A third alternative is to package the relevant jar inside the genericjmara.rar before you deploy it.

Nigel