Hi,
I just downloaded activeMQ 4.1.1 to learn something about message queues.
I started the message broker and used example code to run a JMS client.
I tried to follow the instructions in JNDI support to use JNDI names but had
no luck, I keep getting a javax.naming.NameNotFoundException error. have
included the error message below.
I created a jndi.properties file based on the example shown. have also
included the contents below.
I tried placing the jndi.properties file in my own jar file "jndi.jar"
which i refer to in the classpath.
I also placed the jndi.properties in the apache-activemq-4.1.1.jar . I am
not sure whether the jndi.properties file has
to be placed in a particular location in the jar. Tried a few things but
still I keep getting the error message.
i have also included a java code snippet.
would appreciate any help.
thanks
tony
JMS CLIENT CODE SNIPPET:
=================
ConnectionFactory connectionFactory = null;
Destination dest = null;
try {
connectionFactory =
(ConnectionFactory) jndiContext.lookup("ConnectionFactory");
} catch (Exception e) {
System.out.println("JNDI API lookup for connection failed: " +
e.toString());
e.printStackTrace();
System.exit(1);
}
try{
dest = (Destination) jndiContext.lookup(destName);
} catch (Exception e) {
System.out.println("JNDI API for dest lookup failed: " +
e.toString());
e.printStackTrace();
System.exit(1);
}
JNDI PROPERTIES:
===========
java.naming.factory.initial =
org.apache.activemq.jndi.ActiveMQInitialContextFactory
# use the following property to configure the default connector
java.naming.provider.url = tcp://localhost:61616
# use the following property to specify the JNDI name the connection factory
# should appear as.
#jms.ConnectionFactory = ConnectionFactory
connectionFactoryNames = connectionFactory, queueConnectionFactory,
topicConnectionFactry
# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.jms.Queue = PhysicalQueue
# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
jms.Topic = PhysicalTopic
ERROR MESSAGE:
==========
JNDI API lookup for connection failed: javax.naming.NameNotFoundException:
Conn
ctionFactory
javax.naming.NameNotFoundException: ConnectionFactory
at
org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java
215)
at javax.naming.InitialContext.lookup(Unknown Source)
at
SimpleProducer.main(SimpleProducer.java:94)javax.naming.NameNotFoundException
--
View this message in context: http://www.nabble.com/javax.naming.NameNotFoundException---JNDI-tf3643462s2354.html#a10175148
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
|