You need to include a jndi service provider.  

With ActiveMQ you can follow these instructions:

http://activemq.apache.org/jndi-support.html 



________________________________
From: sonicfab <fabien.copp...@gmail.com>
To: users@activemq.apache.org
Sent: Fri, March 25, 2011 8:11:32 PM
Subject: JNDI lookup problem from standalone VM

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.

Reply via email to