Discussion:
lookup for jndi services
geniusit
2016-11-15 16:55:42 UTC
Permalink
Hello,

I registered a connection factory on my servicemix instance as you can see :

***@root>jndi:names
JNDI Name | Class Name
------------------------------------------------------------------------------------
/local/service/CF_SMX_DEV_01 |
org.apache.activemq.pool.PooledConnectionFactory
osgi:service/jms/default-cf-xa |
org.apache.activemq.pool.JcaPooledConnectionFactory
osgi:service/jms/CF_SMX_DEV_01 |
org.apache.activemq.pool.PooledConnectionFactory
osgi:service/jndi |
org.apache.karaf.jndi.internal.JndiServiceImpl
osgi:service/jms/default-cf |
org.apache.activemq.pool.PooledConnectionFactory


Is a standard java application able to get the connection factory through
jndi lookup ?

Properties jndiParameters = new Properties();
jndiParameters.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
jndiParameters.put(Context.PROVIDER_URL, "tcp://localhost:61616");
Context context = new InitialContext(jndiParameters);

ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("CF_SMX_DEV_01");

Whatever I do, i got a javax.naming.NameNotFoundException?

So how to subscribe to a topic defined in the embedded activemq instance?

Thankx



--
View this message in context: http://servicemix.396122.n5.nabble.com/lookup-for-jndi-services-tp5724093.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Loading...