I created a JMS Resource Group al with Connection Factory w, Topic ac and
Queue qi. I tried to access the Connection Factory from a plain java class
in the same JVM. While executing it from command prompt I am seeing the
following error:
javax.naming.NameNotFoundException: w
All I have is MessageReceiving.java, MessageSending.java, MessageListener
implementing class and jndi.properties. No descriptor files, no archive
files. Code is:
import javax.jms.*;
import javax.jms.Queue;
import java.util.*;
import java.io.*;
import javax.naming.*;
class MessageReceiving {
public static void main(String[] args) throws Exception {
Properties p = new Properties();
p.load(new FileInputStream("jndi.properties"));
InitialContext ic = new InitialContext(p);
QueueConnectionFactory qcf = (QueueConnectionFactory)
ic.lookup("w");
QueueConnection qc = qcf.createQueueConnection();
QueueSession qs =
qc.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
Queue q = (Queue) ic.lookup("q");
QueueReceiver qreceiver = qs.createReceiver(q);
qreceiver.setMessageListener(new MyListener());
qc.start();
Thread.currentThread().join();
}
}
jndi.properties
----------------
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=vm://localhost
java.naming.security.principal=system
java.naming.security.credentials=manager
I have seen the help to my previous questions but unable to figure out where
it's going wrong.
--
View this message in context:
http://www.nabble.com/NameNotFoundException-for-connection-factory-tp21703497s134p21703497.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.