users@glassfish.java.net

help initial context for Jndi with Datasource in Glassfish

From: <glassfish_at_javadesktop.org>
Date: Fri, 14 Nov 2008 01:20:15 PST

Hi to everybody I have many problem to acquire the initial context for looking up my datasource in Glassfish. I have attached my code, when I run it in Eclipse 3.4.1 I get this

javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
        at javax.naming.InitialContext.init(InitialContext.java:240)
        at javax.naming.InitialContext.<init>(InitialContext.java:214)
        at TestDs.main(TestDs.java:25)
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:63)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
        ... 4 more
Exception in thread "main" java.lang.NullPointerException
        at TestDs.main(TestDs.java:44)

please help me.
[Message sent by forum member 'arpho' (arpho)]

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