users@glassfish.java.net

javax.naming.NoInitialContextException on Glassfish version 3

From: <glassfish_at_javadesktop.org>
Date: Mon, 15 Feb 2010 06:52:50 PST

Hi

I am writing a client simple stateless bean and getting a following exception ..

 Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at abc.HelloClient.main(HelloClient.java:25)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

my client code is ..
 public static void main(String[] args)throws Exception {
        // TODO code application logic here

        Context ctx = new InitialContext();
        hello hel1 = (helloo) ctx.lookup("abc.hello");
        hel1.sayHello();
    }



am I missing some jar in my classpath? this is glassfish version 3 server..
I was looking other threads ans realized that there is a some appserver-rt.jar for glassfish version 2 which needs to be added in my classpath. what is equivalent jar for version 3 or there is any other problem .Please let me know.
[Message sent by forum member 'mahagarw' (mahagarw_at_gmail.com)]

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