activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From everett <ever...@mailinator.com>
Subject Re: ActiveMQ causes application to hang on Glassfish
Date Mon, 07 Jul 2008 16:54:54 GMT

Hi Hans,


Hans Bausewein wrote:
> 
> 
> everett wrote:
>> 
>> Hi,
>> 
>> I am using the 5.1.0 release of ActiveMQ. My JVM is version 1.6.0_06 and
>> I am running on Debian Sid. I have a Java web application which uses
>> ActiveMQ that I have deployed in Glassfish V2 UR2. Both Glassfish and
>> ActiveMQ are running on the same server.
>> ............
>> 
> 
> Probably a classloading conflict between GlassFish JMS classes and the
> ActiveMQ implementation.
> 
> The only way to do this properly is to install the ActiveMQ resource
> adapter in GlassFish.
> 
> See
>   http://activemq.apache.org/resource-adapter.html
> 
> The resource adapter binds the ActiveMQ ConnectionFactory into JNDI and
> your application does a JNDI lookup to get it.
> 
> This has many advantages:
> - No direct dependency of your application on ActiveMQ
> - connection pooling
> - clustering
> - failover
> 
> Hans
> 
> 

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)
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

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
 

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


Mime
View raw message