2 Replies Latest reply on May 11, 2006 2:08 AM by Deepak Nohwal

    WARN  [NamingService] Context.PROVIDER_URL in server jndi.pr

    Deepak Nohwal Newbie


      I have my EJB application deployed on JBoss 4.0.2. Now, for looking up the EJB, I need to create the InitialContext object. However, I would like that in my code, I should not specify the URL to which the InitialContext should connect to. That's because the entire application is deployed in the same JVM and I'd like my application to get whatever InitialContext it can. Hence I coded my application like:

      InitialContext ctx = new InitialContext();

      As you can see, I have not specified any environment properties in the constructor of InitialContext.

      Now, for the configuration file, I modified the /conf/jndi.properties file to include the following line:


      I would expect that during the construction of InitialContext, it will use this jndi.properties file (as this is already available on classpath) and will return me the correct InitialContext.

      The code actually works fine except that I notice the following warning on Jboss Console:

      11:46:11,269 WARN [NamingService] Context.PROVIDER_URL in server jndi.properties, url=localhost:1099

      Can someone explain the reason to me or am I missing something here? BTW, when I saw the source code of org.jboss.naming.NamingService class (the one which throws this warning), it had the following comments on top of the code where warning is being logged.

      Create a default InitialContext and dump out its env to show what properties were used in its creation. If we find a Context.PROVIDER_URL property issue a warning as this means JNDI lookups are going through RMI.

      I wonder why it is so. Any clues?


        • 1. Re: WARN  [NamingService] Context.PROVIDER_URL in server jnd
          jaikiran pai Master

          I am not exactly sure of the WARN message, but here's what you can do:

          1) Instead of changing the jndi.properties file present in the conf/ directory of JBOSS, i would suggest, you create a separate jndi.properties file for your application and package it with your application so that its available in the classpath. (However, as far as i know, using the jndi.properties present in the conf/ directory is NOT the cause of this WARN message. )

          2) In the jndi.properties, use:


          Note the word jnp in the url.

          In all, your jndi.properties should look like:


          Try this out. I am also not sure how serious that WARN message is, since the code is working fine.

          • 2. Re: WARN  [NamingService] Context.PROVIDER_URL in server jnd
            Deepak Nohwal Newbie

            Thanks Kiran....I suspected that I need to specify a separate jndi.properties file because if you notice the comment in the NamingService class it says,

            "Context.PROVIDER_URL in server jndi.properties."

            So it says that the file present in /conf is a server side jndi.properties (whatever it means). And the error is certainly because of specifying the url in /conf/jndi.properties. This is evident by taking a look at org.jboss.naming.NamingService class code.

            BTW, a few more interesting observations:

            a) If I specify the url as "jnp://localhost:1099" in /conf/jndi.properties file then I receive a ClassCastException in JBoss while trying to instantiate NamingService.

            b) I have my own properties file read/write mechanism built in my application. So I used my this properties file to specify these values and changed code to create InitialContext using these values from the properties file.

            anyways, thanks. My application would still work though I'd love to find out the reasons for the warning.