activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wallace <wallace3...@yahoo.com>
Subject Re: JBoss integration and lookup of connection factories.
Date Tue, 10 Apr 2007 16:19:16 GMT

Thanks for response.

This works for me too. But it is a very big limitation to require the client
to hard code the physical queue name (in your example, example.MyQueue). It
defeats the purpose of jndi.  The client should only need to know the jndi
name. So no code change is necessary when the server change the physical
name.

It is now a funny situation. If I lookup from activemq jndi, I have to pass
in the physical name. I can actually lookup the topic name from jboss jndi.
But if I lookup from jboss jndi, connection factory will return null (It
looks like a bug to me as context list binding returns the correct class
name).  Neither of the jndi server gets me both things right.

Thanks for your help though.
-Wallace


rachit goel wrote:
> 
> @ WALLACE
> 
> Yes i have successfully implemented the jms thing rom core java 
> application. 
> 
> if u use 
> 
>                 Properties	Initialcontext_props = null;
> 		
> 		queueName = "example.MyQueue";
> 		
> 		Initialcontext_props = new Properties();
> 		Initialcontext_props.put(Context.INITIAL_CONTEXT_FACTORY ,
> "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
> 		Initialcontext_props.put(Context.PROVIDER_URL, "tcp://app-minim:61616");
> 	
> Initialcontext_props.put("connectionFactoryNames","jms/QueuecConFactory");
> 		Initialcontext_props.put("queue.MyQueue" , queueName);
> 
> 	       jndiContext = new InitialContext(Initialcontext_props);
> 
> 
> it will work just fine . Also make sure u have addedd the active-mq's jar
> file in ur classpath.
> 
> 
> 
> wallace wrote:
>> 
>> I can make the jndi lookup working within jboss j2ee container. But jndi
>> apparently does not work from a single standalone client, when accessing
>> jndi of jboss.
>> 
>> For example,
>>            Properties env2 = new Properties();
>>            ......
>>            env2.put(Context.INITIAL_CONTEXT_FACTORY,
>> "org.jnp.interfaces.NamingContextFactory");
>>            env2.put(Context.PROVIDER_URL, "jnp://localhost:1099");
>>            InitialContext jndi2 = new InitialContext(env2);          
>>            
>>            TopicConnectionFactory connectionFactory =
>> (javax.jms.TopicConnectionFactory)
>> jndi2.lookup("java:activemq/TopicConnectionFactory");
>>            
>> The code always returns name not found exception. Has anyone ever made it
>> work in standalone client?
>> 
>> -Wallace Wong
>> 
>> 
>> 
>> tbaker73 wrote:
>>> 
>>> James, could you please provide an example of the connection factory
>>> entry to add under <connection-factories> in a -ds.xml file that would
>>> accomplish what you suggest? How would it differ from this entry?
>>>    <tx-connection-factory>
>>>       <jndi-name>activemq/QueueConnectionFactory</jndi-name>
>>>       <xa-transaction/>
>>>       <track-connection-by-tx/>
>>>       <rar-name>activemq-ra.rar</rar-name>
>>>      
>>> <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
>>>       <ServerUrl>vm://localhost</ServerUrl>
>>>       <UserName>sa</UserName>
>>>       <Password></Password>
>>>       <min-pool-size>1</min-pool-size>
>>>       <max-pool-size>200</max-pool-size>
>>>       <blocking-timeout-millis>30000</blocking-timeout-millis>
>>>       <idle-timeout-minutes>3</idle-timeout-minutes>
>>>    </tx-connection-factory>
>>> 
>>> 
>>> James.Strachan wrote:
>>>> 
>>>> 
>>>> You'll need to setup a regular JMS connection and any destination
>>>> objects you want in JNDI somewhere. Using JBoss's JNDI provider could
>>>> well work fine though - just make sure its actually normal JMS client
>>>> objects (ConnectionFactory & destinations) - and not RA stuff.  Also
>>>> make sure the J2EE server and your stand alone client are using the
>>>> exact same ActiveMQ jars since its gonna be using Java serialization
>>>> to transmit the Java objects in JNDI
>>>> -- 
>>>> 
>>>> James
>>>> -------
>>>> http://radio.weblogs.com/0112098/
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JBoss-integration-and-lookup-of-connection-factories.-tf3061463s2354.html#a9922505
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message