users@glassfish.java.net

JNDI Lookup failing in IDE, but working on server

From: <glassfish_at_javadesktop.org>
Date: Thu, 28 May 2009 11:41:07 PDT

Hello!

I'm using a trial version of IBM Data Studio Developer (v.2.1). It is based on Eclipse Ganymede. My development env is a Win XP machine with a local GlassFish server v. 2.1. On this server I have created a JDBC resource that connects to an Informix server v. 11.5 (the informix server is remote). I can PING the Connection Pool from the admin console.

In my client code I connect to the JDBC resource as follows:

ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/resourcename");

When I deploy the application to the server and launch it from the admin console, it starts and works fine, showing data from the database in the UI.

But when I try to run it from within eclipse/data studio, it doesn't work. Is this situation similar to a remote/standalone client looking up a jndi resource on GlassFish? I tried to set the environment variables for the server url:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
 "com.sun.appserv.naming.S1ASCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:3700");
ic = new InitialContext(env);

DataSource ds = (DataSource) ic.lookup("jdbc/resourcename");

but it still doesn't work. It cannot find the class sun.security.x509.X509CertImpl (same error with or without the env variables).

************************************************************************
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: sun.security.x509.X509CertImpl
        at java.lang.J9VMInternals.verifyImpl(Native Method)
        at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
        at com.sun.enterprise.iiop.J2EEInitializer.post_init(J2EEInitializer.java:174)
        at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.postInitORBInitializers(PIHandlerImpl.java:819)
        at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.initialize(PIHandlerImpl.java:245)
        at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:639)
        at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:701)
        at org.omg.CORBA.ORB.init(ORB.java:364)
        at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:546)
        at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:278)
        at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:178)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:240)
        at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357)
        at javax.naming.InitialContext.internalInit(InitialContext.java:295)
        at javax.naming.InitialContext.<init>(InitialContext.java:212)
        at javax.naming.InitialContext.<init>(InitialContext.java:199)

*******************************************************************************

Does anybody have a clue or idea what it could be?
[Message sent by forum member 'ludmillab' (ludmillab)]

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