Hi there,
I'd like to know if it is possible to access a jdbc resource created on sun app server can be accessing using jndi name from a standalone application. Also I'd like to know if a standalone java application can lookup a jms resource.
I tried doing the above however I get the following error message "javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]"
Please find enclosed the code that I wrote. Any inputs would be much appreciated.
Hashtable env;
Context jndiContext = null;
try
{
env = new Hashtable();
// For use with the File System JNDI Service Provider
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:33700");
// env.put( Context.URL_PKG_PREFIXES ,
//"com.sun.enterprise.naming");
jndiContext = new InitialContext(env);
}
catch (NamingException e)
{
System.out.println("Could not create JNDI API " +
"context: " + e.toString());
System.exit(1);
}
try
{
Object obj1 = jndiContext.lookup("jdbc/INSTA");
//Object obj1 = jndiContext.lookup("jms/MyQCF");
System.out.println("Look up successful");
}
catch (NamingException e)
{
System.out.println("JNDI API lookup failed: " +
e.toString());
System.exit(1);
}
Regards
[Message sent by forum member 'kakkarjatin' (kakkarjatin)]
http://forums.java.net/jive/thread.jspa?messageID=291440