0 Replies Latest reply on Oct 21, 2004 2:32 PM by James Adams

    HA-JNDI and jndi.properties

    James Adams Novice

      I'm unable to start the NamingService when I set the java.naming.provider.url property in jndi.properties to the URL for the HA-JNDI tree. When I set this property to anything other than localhost:1099 (or jnp://localhost:1099, or nothing at all) then JBoss complains when starting up the NamingService:

      13:30:37,596 WARN [NamingService] Context.PROVIDER_URL in server jndi.properties, url=localhost:1100
      13:30:37,940 WARN [NamingContext] Failed to connect to localhost:1100
      javax.naming.CommunicationException: Failed to connect to server localhost:1100 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1100 [Root exception is java.net.ConnectException: Connection refused]]
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:213)
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1185)
       at org.jnp.interfaces.NamingContext.bind(NamingContext.java:468)
       at org.jnp.interfaces.NamingContext.bind(NamingContext.java:461)
       at javax.naming.InitialContext.bind(InitialContext.java:355)
      
       etc...
      


      It seems that the NamingService uses the values in this properties file, and since the HANamingService, which provides the HA-JNDI tree at the port I'm specifying in jndi.properties, hasn't been started yet (it gets started later on when cluster-service.xml is processed) the NamingService fails to connect.

      I'm working around this by omitting the java.naming.provider.url property in jndi.properties, and in my Java codes specifying the HA-JNDI port in a Hashtable which I pass to the InitialContext constructor. So if I need to change the port number for HA-JNDI I must modify all of my Java source files instead of making the change in jndi.properties.

      Is there a way around hard-coding these InitialContext properties in my Java sources, and go back to using the jndi.properties file instead ? I'd much rather specify these properties in a single file than in twenty or more Java source files.

      Thanks in advance for any suggestions.


      --James