You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by moonbird <mo...@ymail.com> on 2009/08/25 21:23:09 UTC

JNDI with ActiveMQ embedded in JBoss AS

Hi, 

i have successfully embedded ActiveMQ via JCA/RA in JBoss 5.1: 
http://activemq.apache.org/integrating-apache-activemq-with-jboss.html 

Now I like to use JNDI to lookup ActiveMQs ConnectionFactory and the
Destinations from a java/jms client outside the application server.

My Problem is, that i get a null pointer object back form jndi lookup, and
this is obviously not new: 
http://www.nabble.com/JBoss-and-ActiveMQ-with-remote-JNDI-to16961289.html#a16961289 

In this thread some JBoss guy writes about this architecture problem: 
JBoss answer 
"/The connection factories provided by a Resource Adapter (RA) are 
typically not available for use by clients that are outside of the 
application server. That is, the JCA specification is intended to 
provided resources to the application server, and relies upon behavior 
on the part of the application server in connection pool management, 
transaction management, and security. 

Also, for this reason, the JNDI location of the RA's ConnectionFactories 
should be located in the "java:" namespace. This namespace is local to 
the jvm and has no visibility to external clients./" 

So my question is, may I use MQ Providers from Clients outside the
application server or may i only use it via EJB components like MDBs ? 

I am confused - because JBoss Messaging is (as far as i know) also embedded
via JCA and also bound to global JNDI and - I can successfully lookup the
JBoss Messaging ConnectionFactory from a client outside !!! Why does it work
- is this bug a feature ? ;-) 

Thx so far ! 

-- 
View this message in context: http://www.nabble.com/JNDI-with-ActiveMQ-embedded-in-JBoss-AS-tp25140603p25140603.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: JNDI with ActiveMQ embedded in JBoss AS

Posted by Gary Tully <ga...@gmail.com>.
This all makes sense, the appserver makes RAR objects available in the
application servers moduile private "java:" JNDI context but there is no
logic to register activmq destinations and factories directly in the global
jndi tree.

It is possible to use the activemq initail context to resolve activemq
objects.
I guess you have read: http://activemq.apache.org/jndi-support.html

The key is to use a different initial context for clients outside the
appserver, a different value for the jndi system property:
java.naming.factory.initial.

java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

and an appropriate brokerUrl in:
java.naming.provider.url=tcp://hostname:61616

Note that the JNDI name used for the client lookup will be different, it
will not use a "java:" prefix for example and will need to match the naming
convention of the activemq initialcontext.


2009/8/25 moonbird <mo...@ymail.com>

>
> Hi,
>
> i have successfully embedded ActiveMQ via JCA/RA in JBoss 5.1:
> http://activemq.apache.org/integrating-apache-activemq-with-jboss.html
>
> Now I like to use JNDI to lookup ActiveMQs ConnectionFactory and the
> Destinations from a java/jms client outside the application server.
>
> My Problem is, that i get a null pointer object back form jndi lookup, and
> this is obviously not new:
>
> http://www.nabble.com/JBoss-and-ActiveMQ-with-remote-JNDI-to16961289.html#a16961289
>
> In this thread some JBoss guy writes about this architecture problem:
> JBoss answer
> "/The connection factories provided by a Resource Adapter (RA) are
> typically not available for use by clients that are outside of the
> application server. That is, the JCA specification is intended to
> provided resources to the application server, and relies upon behavior
> on the part of the application server in connection pool management,
> transaction management, and security.
>
> Also, for this reason, the JNDI location of the RA's ConnectionFactories
> should be located in the "java:" namespace. This namespace is local to
> the jvm and has no visibility to external clients./"
>
> So my question is, may I use MQ Providers from Clients outside the
> application server or may i only use it via EJB components like MDBs ?
>
> I am confused - because JBoss Messaging is (as far as i know) also embedded
> via JCA and also bound to global JNDI and - I can successfully lookup the
> JBoss Messaging ConnectionFactory from a client outside !!! Why does it
> work
> - is this bug a feature ? ;-)
>
> Thx so far !
>
> --
> View this message in context:
> http://www.nabble.com/JNDI-with-ActiveMQ-embedded-in-JBoss-AS-tp25140603p25140603.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com