I configured the queue by setting it up in activeemq.xml (ActiveMQ version 5.2.0), as described in the documentation .
<destinations> <queue physicalName="FOO.BAR" /> <queue physicalName="DUMMY" /> </destinations>
I am trying to access it from java (on the same host) with the following code:
Hashtable properties = new Hashtable(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); properties.put(Context.PROVIDER_URL, "tcp://localhost:61616"); context = new InitialContext(properties); factory = (ConnectionFactory) context.lookup("ConnectionFactory"); connection = factory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); queueName = "DUMMY"; // which can be either FOO.BAR or DUMMY dest = (Destination) context.lookup(queueName);
I get the following error, although the queue is visible in jconsole (Tree / org.apache.activemq / Queue):
javax.naming.NameNotFoundException: DUMMY
Please tell me what I'm doing wrong. Thank you so much!
java jms activemq
Mrg
source share