2 Replies Latest reply on Sep 13, 2002 11:43 PM by Andres Gonzalez

    javax.naming.NoInitialContextException

    Andres Gonzalez Newbie

      Hi guys... I've been searching this forum and tried different things to solve this problem, but no luck at all. I'm gettn this exception:

      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:640)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at example.cmp.client.MyClient.main(Unknown Source)

      What I've tried to do is the following:

      1o.) insert these two lines in my main class:

      System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.provider.url", "localhost:1099");

      No luck

      2o.)
      My client jar file is the following:

      MyClient.class
      jndi.properties
      Manifest.fm

      inside my Manifest I have included the following:
      Manifest-Version: 1.0
      Created-By: Apache Ant 1.5Beta3
      Main-Class: example.cmp.client.MyClient
      Class-Path: jnp-client.jar jndi.jar log4j.jar

      but no luck at all...

      what am I doing wrong?