1 Reply Latest reply on Apr 27, 2006 10:45 PM by jaikiran

    Error javax.naming.NoInitialContextException

    praveen_imt

      Hi All,

      I am new to EJB and JBoss. I have created stateless Session EJB's (using Jdevloper) and the JBoss has deployed them successfully...but when i run my application from JBoss....I receive the following error...

      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

      javax.naming.Context javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable)

      NamingManager.java:643

      javax.naming.Context javax.naming.InitialContext.getDefaultInitCtx()

      InitialContext.java:246

      javax.naming.Context javax.naming.InitialContext.getURLOrDefaultInitCtx(java.lang.String)

      InitialContext.java:283

      java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)

      InitialContext.java:350

      void mypackage1.WelcomeScreen1_applet.main(java.lang.String[])

      WelcomeScreen1_applet.java:248

      The Java File where it shows the error contains these lines....
      Context ctx = new InitialContext(env);
      ErpFacadeHome = (erpFacadeHome)ctx.lookup("erpFacade");


      Can any one please help me to solve this problem..

      Thanks to all.

        • 1. Re: Error javax.naming.NoInitialContextException
          jaikiran

          You should have a jndi.properties file in your classpath. A typical jndi.properties file will look like:

          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
          java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
          java.naming.provider.url=jnp://localhost:1099


          You can find one such file, in %JBOSS_HOME%/server/default/conf directory.