activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saurabh_d48 <>
Subject Problem in making JNDI connection - Apachive ActiveMQ 5.10.0
Date Mon, 15 Sep 2014 10:04:00 GMT

O.S.: Windows 8 
 Apache 5.10.0 release

I am not able to create a jndi connection from my java program despite
specifying all the connection parameters in the and

I have done the configuration of file as follows:

 java.naming.factory.initial =
1.use the following property to configure the default connector
 java.naming.provider.url = vm://localhost

#connectionFactoryNames = TopicCF
 #topic.topic1 = jms.topic1

connectionFactoryNames = QueueCF
 queue.LoanRequestQ = jms.LoanRequestQ
 queue.LoanResponseQ = jms.LoanResponseQ

Added the following in activemq.xml:

 <! – topic name=&quot;topic1&quot; physicalName=&quot;jms.topic1&quot;
 <queue name="LoanRequestQ" physicalName="jms.LoanRequestQ" />
 <queue name="LoanResponseQ" physicalName="jms.LoanResponseQ" />

Now, in my Java program, I have the QLender class and I have the following

Context ctx = new InitialContext();
 ConnectionFactory qCFactory = (ConnectionFactory)ctx.lookup("QueueCF");

I get the following 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
 at javax.naming.spi.NamingManager.getInitialContext(
 at javax.naming.InitialContext.getDefaultInitCtx(
 at javax.naming.InitialContext.lookup(
 at ch04.p2p.QLender.<init>(
 at ch04.p2p.QLender.main(

Further I enhanced the program to make a set of environment parameters:

 Hashtable env = new Hashtable();
 env.put(Context.PROVIDER_URL, "http://localhost:61616");
 env.put(Context.SECURITY_PRINCIPAL, "system");
 env.put(Context.SECURITY_CREDENTIALS, "manager");
 Context ctx = new InitialContext(env); 
 ConnectionFactory qCFactory = (ConnectionFactory)ctx.lookup("QueueCF");

On compiling I get the following error:
 javax.naming.NameNotFoundException: QueueCF
 at javax.naming.InitialContext.lookup(
 at ch04.p2p.QLender.<init>(
 at ch04.p2p.QLender.main(QLender

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message