Standalone JMS client in SJS App Server 8.0
843833May 11 2005 — edited Jun 1 2005Hi
I am trying to retrieve a message from a JMS queue from astandalone client.
The code the client uses to lookup JMS resources is:
try
{
/* Create the object of InitialContext interface */
Properties env = new Properties( );
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL,"iiop://localhost:3700");
jndiContext = new InitialContext(env);
/* Find the connection factory object */
QConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("jms/QConnectionFactory");
/* Find the queue */
queue = (Queue) jndiContext.lookup("jms/Queue");
}
catch (NamingException e)
{
System.out.println("Error: " + e.toString());
}
The code throws the following exception:
Error: javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.N
amingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
Exception in thread "main" java.lang.NullPointerException
at QReceiver.main(QReceiver.java:51)
What might be the problem? Pls help. The code works fine when executed as an Application client of SJS Appserver without using the JNDI Context part.
Thanks in advance
JLRocky