activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bausewein <>
Subject Re: ActiveMQ causes application to hang on Glassfish
Date Mon, 07 Jul 2008 18:29:06 GMT

everett wrote:
> Thank you for the tip. I've taken a look at Ramesh's excellent guide
> (

It was good for ActiveMQ 4, but it uses a generic JMS resource adapter,
which makes it quite complicated (though I guess it should still work).

BTW: I didn't read this page until now. I'm using ActiveMQ with JBoss and it
worked almost out-of-the-box.

everett wrote:
>  but it goes a bit over my head in certain places.
> I specifically have difficulty understanding two things:
> 1. The filesystem JNDI object store
> 2. How to deploy a sun-ejb-jar.xml file

You probably do not want that.

Unless you want to deploy an EJB.

everett wrote:
> Regarding the JNDI object store creation code
> (, am I
> supposed to deploy it with my web app?
> Instead of a filesystem object store I tried with a file:
>         java.naming.factory.initial =
> org.apache.activemq.jndi.ActiveMQInitialContextFactory
>         java.naming.provider.url = stomp://localhost:61613
> I managed to do everything else Ramesh specified, and I deployed the
> sun-ejb-jar.xml file he provides in my META-INF directory. Is that the
> correct location?
> I tried using the following code in my web app (based on
>         import javax.jms.Connection;
>         import javax.jms.ConnectionFactory;
>         ...
>         ConnectionFactory connectionFactory =
> (ConnectionFactory)jndiContext.lookup("ConnectionFactory");
>         Connection connection = connectionFactory.createConnection();
>         ...
> When I then run the code I get an exception:
>         javax.naming.NameNotFoundException: ConnectionFactory not found
> What am I doing wrong?
> I apologize for my ignorance. ActiveMQ is great software which I would
> prefer to use to RabbitMQ (which appears to be my only option if I don't
> get this working).
> Again, I appreciate your help.
> --
> Everett

The last part is correct. Except maybe for the JNDI name

The ActiveMQ resource adapter is "activemq-rar-5.1.0.rar"

I don't know so much about Glassfish, but you somehow must deploy this one
to it.
You should not have to copy ActiveMQ libraries, because they are included in
the 'rar'.

If you run ActiveMQ stand-alone on the same machine, the default
configuration in "META-INF/ra.xml" should work. Otherwise set the ServerUrl
(see )

It comes configured with ConnectionFactory, QueueConnectionFactory and
If you don't need XA transactions, that's enough. (if you don't know what XA
transactions are, you don't need them ;-))

The "resourceadapter/connection-definition/connectionfactory-interface"
property in "ra.xml" is referenced by GlassFish.

If I understand Ramesh' description correctly, then you must replace
"genericra" with "activemq-rar-5.1.0.rar"  (= value of "rar-name" property
in "ra.xml").

"connectiondefinition javax.jms.QueueConnectionFactory" is fine, but it
means that you'll get a javax.jms.QueueConnectionFactory. If you want the
generic (Queue and Topic) ConnectionFactory specify "connectiondefinition

Replace "––transactionsupport XATransaction" with "––transactionsupport
(unless you want XA transactions) or remove it.

I think you should get the ActiveMQ ConnectionFactory using:

ConnectionFactory connectionFactory =

if I understand it correctly.

If you manage to get log4j logging in GlassFish, it helps a lot to enable
DEBUG level:

   <category name="org.apache.activemq">
      <priority value="DEBUG"/>

Then you can see, what ActiveMQ is doing. (or not doing)



View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message