title: Problems with shutting down JBoss in Eclipse if I change JNDI port
body: <h1>  1st phase</h1>
  
  <p>I have a problem shutting down my running JBoss instance under Eclipse since I changed
    the JNDI port of JBoss. Of course I can shut it down from the console view but not with
    the stop button (it still searches JNDI port at the default 1099 port). I'm looking
    forward to any solutions. Thank you! </p>
  
  <h2>Used environment:</h2>
  
  <ul>
  <li>JBoss 4.0.2  (using <em>default</em>)</li>
  <li>Eclipse 3.4.0. (using JBoss Tools 2.1.1.GA)</li>
  </ul>
  
  <p>Default ports: 1098, 1099
  Changed ports: 11098, 11099</p>
  
  <p>I changed the following part in jbosspath/server/default/conf/jboss-service.xml:</p>
  
  <pre><code>   &lt;!-- ==================================================================== --&gt;
     &lt;!-- JNDI                                                                 --&gt;
     &lt;!-- ==================================================================== --&gt;
  
     &lt;mbean code="org.jboss.naming.NamingService"
        name="jboss:service=Naming"
        xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"&gt;
        &lt;!-- The call by value mode. true if all lookups are unmarshalled using
        the caller's TCL, false if in VM lookups return the value by reference.
        --&gt;
        &lt;attribute name="CallByValue"&gt;false&lt;/attribute&gt;
        &lt;!-- The listening port for the bootstrap JNP service. Set this to -1
          to run the NamingService without the JNP invoker listening port.
        --&gt;
        &lt;attribute name="Port"&gt;11099&lt;/attribute&gt;
        &lt;!-- The bootstrap JNP server bind address. This also sets the default
        RMI service bind address. Empty == all addresses
         --&gt;
        &lt;attribute name="BindAddress"&gt;${jboss.bind.address}&lt;/attribute&gt;
        &lt;!-- The port of the RMI naming service, 0 == anonymous --&gt;
        &lt;attribute name="RmiPort"&gt;11098&lt;/attribute&gt;
        &lt;!-- The RMI service bind address. Empty == all addresses
         --&gt;
        &lt;attribute name="RmiBindAddress"&gt;${jboss.bind.address}&lt;/attribute&gt;
        &lt;!-- The thread pool service used to control the bootstrap lookups --&gt;
        &lt;depends optional-attribute-name="LookupPool"
           proxy-type="attribute"&gt;jboss.system:service=ThreadPool&lt;/depends&gt;
     &lt;/mbean&gt;
  
     &lt;mbean code="org.jboss.naming.JNDIView"
          name="jboss:service=JNDIView"
          xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml"&gt;
     &lt;/mbean&gt;
  </code></pre>
  
  <h2>Eclipse setup:</h2>
  
  <p><img src="https://i.stack.imgur.com/nOlhy.png" width="500" title="jndi port to 11099" /></p>
  
  <p><em>About my JBoss Tools preferences:</em> 
  I had a previous version, I got this problem, I read about some bugfix in JbossTools, so updated to 2.1.1.GA. Now the buttons changed, and I've got a new preferences view, but I cannot modify anything...seems to be abnormal as well:</p>
  
  <p><img src="https://i.stack.imgur.com/Ocfcf.png" width="620" /></p>
  
  <h2>Error dialog:</h2>
  
  <p><img src="https://i.stack.imgur.com/uPPZ7.png" width="300" title="can't reach server" /></p>
  
  <h2>The stacktrace:</h2>
  
  <pre><code>javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is 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.checkRef(NamingContext.java:1385)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at org.jboss.Shutdown.main(Shutdown.java:202)
  Caused by: 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(NamingContext.java:254)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
      ... 4 more
  Caused by: 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(NamingContext.java:228)
      ... 5 more
  Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:452)
      at java.net.Socket.connect(Socket.java:402)
      at java.net.Socket.&lt;init&gt;(Socket.java:309)
      at java.net.Socket.&lt;init&gt;(Socket.java:211)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
      ... 5 more
  Exception in thread "main" 
  </code></pre>
  
  <h1> 2nd phase:</h1>
  
  <p>After creating a new Server in File/new/other/server, it did appear in the preferences tab. Now the stop button is working (the server receives the shutdown messages without any additional modification of the jndi port -- there is no opportunity for it now) but it still throws an error message, though different, it's without exception stack trace: "Server JBoss 4.0 Server failed to stop."</p>