Hi I am new user.
I am getting the error for JNDI lookup as below
java.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
1) I have included jndi.properties in the classpath
2) I have started and created queue from jmx-console.
But still I am not able to get it work. Any help on this appreciated.
Thanks
-------------------------------------------
my jndi.properties look like this
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider=localhost:1099
------------
This is part of my program using JNDI lookup
try {
jndiContext = new InitialContext();
} catch (Exception e) {
System.out.println("Couldnot create JNDI API Context:" +
e.toString());
System.exit(1);
}
try {
queueConnectionFactory = (QueueConnectionFactory)
jndiContext.lookup("ConnectionFactory");
queue = (Queue) jndiContext.lookup("queue/testQueue");
} catch (Exception e) {
System.out.println("JNDI lookup failed" + e.toString());
System.exit(1);
}
------------
This is the command I am using
java -cp /opt/hpws/jboss/server/default/lib/jboss-j2ee.jar:. -Djms.properties=/opt/hpws/jboss/server/default/conf/jndi.properties SimpleQueueSender testQueue 3
--------------------