users@glassfish.java.net

Re: Accessing DataSources via JNDI remotely or from out-of-container vm's

From: <glassfish_at_javadesktop.org>
Date: Tue, 24 Jul 2007 04:59:34 PDT

Sure!

I do:

        Properties props = new Properties();
        props.setProperty("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
        props.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
        props.setProperty("org.omg.CORBA.ORBInitialPort","3700");
        InitialContext ic = new InitialContext(props);
        ic.lookup("jdbc/__default");

I get:

xception in thread "main" javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
        at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
        at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at pruebas.GfJndi.main(GfJndi.java:29)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
        at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
        at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
        at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
        ... 4 more
Java Result: 1

Environment:

 - Windows XP
 - jdk1.5.0_12
 - Sun Java System Application Server 9.1 (build b50g-beta3) = GF v2 beta3 downloaded couple of days ago
 - client code and app server running on same pc
[Message sent by forum member 'andresgr' (andresgr)]

http://forums.java.net/jive/thread.jspa?messageID=227925