You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by ppr <ac...@philippe.prados.name> on 2008/04/29 16:25:30 UTC

JBoss and ActiveMQ with remote JNDI

I want use a JBoss remote JNDI to find the connection factory and queues.
I use the RAR integrated in each server, the JNDI client and the JNDI
serveur with the ActiveMQ.

The lookup return "null".

Is it possible to use this architecture ?

Regards

Philippe
-- 
View this message in context: http://www.nabble.com/JBoss-and-ActiveMQ-with-remote-JNDI-tp16961289s2354p16961289.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: JBoss and ActiveMQ with remote JNDI

Posted by James Strachan <ja...@gmail.com>.
2009/8/7 An An <an...@gmail.com>:
>
> Hi James,
> Thanks for the reply.
> I have set the JBoss jndi properties already.
> So I do this in the code :-
> <<
> Properties props = new Properties();
>
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
>                props.setProperty(Context.PROVIDER_URL,"tcp://localhost:61616");
>                javax.naming.Context ctx = new InitialContext(props);
>                Queue queue = (Queue) ctx.lookup("activemq/queue/outbound");


If you are going to create your own JNDI properties, this page
describes how to configure resources inside JNDI
http://activemq.apache.org/jndi-support.html

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: JBoss and ActiveMQ with remote JNDI

Posted by An An <an...@gmail.com>.
Hi James,
Thanks for the reply.
I have set the JBoss jndi properties already.
So I do this in the code :-
<<
Properties props = new Properties();   
	
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");   
		props.setProperty(Context.PROVIDER_URL,"tcp://localhost:61616");   
		javax.naming.Context ctx = new InitialContext(props);
		Queue queue = (Queue) ctx.lookup("activemq/queue/outbound");
		queueConnectionFactory = (ActiveMQConnectionFactory) ctx.lookup
("activemq/QueueConnectionFactory");
		connection = queueConnectionFactory.createQueueConnection();
	    connection.start();
	    QueueSession session =
connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
		queueSender = session.createSender(queue);

>>

However I get the following error :
javax.naming.NameNotFoundException: activemq/queue/outbound

I have set the jndi context to global for this queue in activemq_jms-ds.xml
inside Jboss server deploy.

I am trying this from standalone Java client. 
Would that be the problem or is there something I am missing?

Thanks for your help so far

Regards,
An


James.Strachan wrote:
> 
> 2008/4/29 Alex Soto <le...@gmail.com>:
>> James Strachan wrote:
>>>
>>> 2008/4/29 Alex Soto <le...@gmail.com>:
>>>
>>>>
>>>> I also have the same problem.
>>>>  The suggestions I've seen is to instantiate ActiveMQConnectionFactory
>>>> instead of getting it from JNDI.  As a workaround it is satisfactory
>>>> but
>>>> this solution does not go very far. Certainly it does not help if the
>>>> client
>>>> code is not available for modification.
>>>>
>>>>  Does anybody knows if there is a plan to solve this issue?
>>>>
>>>
>>> Just use the ActiveMQ JNDI provider then?
>>> http://activemq.apache.org/jndi-support.html
>>>
>>
>> Is that possible when ActiveMQ runs embedded within JBoss? How?
> 
> The ActiveMQ JNDI provider is purely local to the JMS client - it
> doesn't matter where the broker is.
> 
> For more background see this FAQ entry:
> http://activemq.apache.org/how-do-i-create-new-destinations.html
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

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


Re: JBoss and ActiveMQ with remote JNDI

Posted by James Strachan <ja...@gmail.com>.
2008/4/29 Alex Soto <le...@gmail.com>:
> James Strachan wrote:
>>
>> 2008/4/29 Alex Soto <le...@gmail.com>:
>>
>>>
>>> I also have the same problem.
>>>  The suggestions I've seen is to instantiate ActiveMQConnectionFactory
>>> instead of getting it from JNDI.  As a workaround it is satisfactory but
>>> this solution does not go very far. Certainly it does not help if the
>>> client
>>> code is not available for modification.
>>>
>>>  Does anybody knows if there is a plan to solve this issue?
>>>
>>
>> Just use the ActiveMQ JNDI provider then?
>> http://activemq.apache.org/jndi-support.html
>>
>
> Is that possible when ActiveMQ runs embedded within JBoss? How?

The ActiveMQ JNDI provider is purely local to the JMS client - it
doesn't matter where the broker is.

For more background see this FAQ entry:
http://activemq.apache.org/how-do-i-create-new-destinations.html


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: JBoss and ActiveMQ with remote JNDI

Posted by Alex Soto <le...@gmail.com>.
James Strachan wrote:
> 2008/4/29 Alex Soto <le...@gmail.com>:
>   
>> I also have the same problem.
>>  The suggestions I've seen is to instantiate ActiveMQConnectionFactory
>> instead of getting it from JNDI.  As a workaround it is satisfactory but
>> this solution does not go very far. Certainly it does not help if the client
>> code is not available for modification.
>>
>>  Does anybody knows if there is a plan to solve this issue?
>>     
>
> Just use the ActiveMQ JNDI provider then?
> http://activemq.apache.org/jndi-support.html
>   
Is that possible when ActiveMQ runs embedded within JBoss? How?
-Alex

Re: JBoss and ActiveMQ with remote JNDI

Posted by James Strachan <ja...@gmail.com>.
2008/4/29 Alex Soto <le...@gmail.com>:
> I also have the same problem.
>  The suggestions I've seen is to instantiate ActiveMQConnectionFactory
> instead of getting it from JNDI.  As a workaround it is satisfactory but
> this solution does not go very far. Certainly it does not help if the client
> code is not available for modification.
>
>  Does anybody knows if there is a plan to solve this issue?

Just use the ActiveMQ JNDI provider then?
http://activemq.apache.org/jndi-support.html
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: JBoss and ActiveMQ with remote JNDI

Posted by Alex Soto <le...@gmail.com>.
I also have the same problem. 

The suggestions I've seen is to instantiate ActiveMQConnectionFactory 
instead of getting it from JNDI.  As a workaround it is satisfactory but 
this solution does not go very far. Certainly it does not help if the 
client code is not available for modification.

Does anybody knows if there is a plan to solve this issue?

-Alex

ppr wrote:
> I want use a JBoss remote JNDI to find the connection factory and queues.
> I use the RAR integrated in each server, the JNDI client and the JNDI
> serveur with the ActiveMQ.
>
> The lookup return "null".
>
> Is it possible to use this architecture ?
>
> Regards
>
> Philippe
>   


Re: JBoss and ActiveMQ with remote JNDI

Posted by An An <an...@gmail.com>.
Hi,

I am facing this same issue.
The configuration I have is JBoss 4.0.5 with Active MQ 5.2 embedded, and
MSSQL 2005 for persistence.

Is there a way to get this jndi lookup working?

Thanks,
A


Alex Soto-2 wrote:
> 
> If that is true, how is it possible that the JBossMQ connection  
> factory is available to remote clients?
> I think is against the purpose of the standard if a change in the  
> implementation causes the clients to stop working.
> 
> 
> Alex Soto
> lexsoto@gmail.com
> 
> -
> Amicus Plato, sed magis amica veritas.
> 
> 
> 
> On May 1, 2008, at 12:08 PM, Philippe P. wrote:
> 
>> 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./"
>>
>> Is it true ? I'm not sure. How other application server do ?
>>
>> Philippe
> 
> 
> 

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


Re: JBoss and ActiveMQ with remote JNDI

Posted by Alex Soto <le...@gmail.com>.
If that is true, how is it possible that the JBossMQ connection  
factory is available to remote clients?
I think is against the purpose of the standard if a change in the  
implementation causes the clients to stop working.


Alex Soto
lexsoto@gmail.com

-
Amicus Plato, sed magis amica veritas.



On May 1, 2008, at 12:08 PM, Philippe P. wrote:

> 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./"
>
> Is it true ? I'm not sure. How other application server do ?
>
> Philippe


Re: JBoss and ActiveMQ with remote JNDI

Posted by "Philippe P." <ac...@philippe.prados.name>.
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./"

Is it true ? I'm not sure. How other application server do ?

Philippe

Re: JBoss and ActiveMQ with remote JNDI

Posted by Alex Soto <le...@gmail.com>.
Thank you Philippe, It's good to know.

Alex Soto
lexsoto@gmail.com

-
Amicus Plato, sed magis amica veritas.



On Apr 30, 2008, at 10:51 AM, Philippe P. wrote:

> I find the bug, not the solution now.
>
> The remote JNDI register a  
> org.apache.activemq.ra.ActiveMQManagedConnectionFactory.
> When a remote lookup is done, the remote JNDI server must serialize  
> this instance to send to the client.
> This instance is connected to an ActiveMQResourceAdapter.
> This instance reference a BootstrapContext provided by JBoss.
> JBoss provide a RARDeployment for this context, but this instance  
> is not serializable !
> So, the org.apache.activemq.ra.ActiveMQManagedConnectionFactory  
> connected with a RARDeployment can't be serializable, and can't be  
> use in client JNDI.
>
> :-(
>
> I open a bug to JBoss.
>
> Regards
>
> Philippe


Re: JBoss and ActiveMQ with remote JNDI

Posted by "Philippe P." <ac...@philippe.prados.name>.
I find the bug, not the solution now.

The remote JNDI register a 
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.
When a remote lookup is done, the remote JNDI server must serialize this 
instance to send to the client.
This instance is connected to an ActiveMQResourceAdapter.
This instance reference a BootstrapContext provided by JBoss.
JBoss provide a RARDeployment for this context, but this instance is not 
serializable !
So, the org.apache.activemq.ra.ActiveMQManagedConnectionFactory 
connected with a RARDeployment can't be serializable, and can't be use 
in client JNDI.

:-(

I open a bug to JBoss.

Regards

Philippe