activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bausewein <ha...@comerwell.xs4all.nl>
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
> (http://weblogs.java.net/blog/rampsarathy/archive/2007/03/glassfish_v2_an.html)
> 

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
> (http://weblogs.java.net/blog/rampsarathy/archive/Main.java), am I
> supposed to deploy it with my web app?
> 
> Instead of a filesystem object store I tried with a jndi.properties 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
> http://activemq.apache.org/jndi-support.html):
> 
>         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
"ConnectionFactory".

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 http://activemq.apache.org/resource-adapter-properties.html )

It comes configured with ConnectionFactory, QueueConnectionFactory and
TopicConnectionFactory.
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
javax.jms.ConnectionFactory".

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

http://docs.sun.com/app/docs/doc/819-3662/6n5s9hmti?a=view

I think you should get the ActiveMQ ConnectionFactory using:

ConnectionFactory connectionFactory =
(ConnectionFactory)jndiContext.lookup("activemqconnectionfactory");

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"/>
   </category>

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

success,

Hans


-- 
View this message in context: http://www.nabble.com/ActiveMQ-causes-application-to-hang-on-Glassfish-tp18288240p18323422.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message