2 Replies Latest reply on Apr 15, 2002 5:19 PM by thschwob

    Cannot set up Context in jndi.properties

    tsmets

      I dunno why but if I insert in my jndi.properties


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


      Actually it's all there is in the file :-)
      I got the following Exception :

      [java] Main...
      [java] got the context...
      [java] Exception is : javax.naming.NoInitialContextException
      [java] Exception message is : 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


      While if I set up the Context in the app, like in :

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


      Everything works fine ....
      Could somebody tell me what I could do wrong ?

      Thomas,

        • 1. Re: Cannot set up Context in jndi.properties

          You have to put jndi.properties in your classpath.

          This message is a bit cryptic :-)
          "or in an application resource file: java.naming.factory.initial"

          Regards,
          Adrian

          • 2. Re: Cannot set up Context in jndi.properties
            thschwob

            Hi Adrian,

            I had the same problem, actually with 2.4.3 it worked fine , in 2.4.4 suddendly I got this error.

            But even when I now include the jndi.properties in the classpath (I have a standalone test client, running via JUnit) it doesn't work. I still get that exception.

            Any suggestions why the jndi.properties is not read? When using the client via a servlet running with Tomcat 3.2.3 then everything works. Just problems with the standalone client for testing.

            Regards,
            Thomas