2 Replies Latest reply on Jun 28, 2012 8:21 AM by Filippe Spolti

    changing jnp Port

    sys user Master


      I am using Jboss-4.0.0 and try to change the standard jnp-port(1099) to port 40000. Therefore I made the following modifications within the jboss-service.xml file:

      <mbean code="org.jboss.naming.NamingService"
       <attribute name="Port">40000</attribute>

      Anyway, I got the following error message:

      Failed to connect to localhost:1099
      javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
      at org.jnp.interfaces.NamingContext.getServer...

      Are there further modifications I will have to make???


        • 1. Re: changing jnp Port
          mazz Master

          I recently had sort of the same problem. Searched the forums and had to look hard to find the answer. So, I'll post the answer here, hopefully, people will find this easier.

          If you change the port or (as in my case) the bind address (via the -b option at startup) that will change the bind address of the server.

          But be careful - if you have clients running in your server, the jndi.properties file will take effect in your InitialContext. So, make sure that

          1) Your jndi.properties file matches what you set your server (or don't specify a provider URL in jndi.properties and set it in your InitialContext programatically)


          2) that you don't have a jndi.properties file somewhere in your classpath

          My problem was #2 - unbeknowst to me, I had shutdown.jar in my classpath and it has a jndi.properties that defines provider URL of localhost:1099. If you change the port or bind address, this obviously won't match and you will get this exception that you mention.

          • 2. Re: changing jnp Port
            Filippe Spolti Novice

            Remember, if this attribute is -1 the service is disabled.