activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sonicfab <fabien.copp...@gmail.com>
Subject JNDI lookup problem from standalone VM
Date Sat, 26 Mar 2011 00:11:32 GMT
Hi all.
I'm running an ActiveMQ client in a standalone JVM (i.e. no web or J2EE
container), and am trying to perform a JNDI lookup of the connection
factory, using the standard JMS way of setting the env in a Properties
object (rather than using a jndi.properties file). Here's the code snippet :
Context context;
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
env.setProperty(Context.PROVIDER_URL, "tcp://my_server_name:61616");
javax.naming.Context context = new InitialContext(env);
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory)
context.lookup("ConnectionFactory");

And I get this error :
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial

I don't understand because I have set the Context.INITIAL_CONTEXT_FACTORY
property.

Help please ?
         

--
View this message in context: http://activemq.2283324.n4.nabble.com/JNDI-lookup-problem-from-standalone-VM-tp3406749p3406749.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message