1 Reply Latest reply on Apr 4, 2005 1:44 AM by Vishal Sharma

    refused connection

    Rudi Adianto Newbie


      i get

      javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host:; nested exception is:
      java.net.ConnectException: Connection refused: connect]

      when trying to call remote method on a bean deployed in jboss4.0.1-SP1. the machine is running mandrake linux 10 kernel 2.6.7.

      im able to call the bean from servlet running on the same jboss installation. i got the above exception when calling the method from a standalone client running on different machine (windows).

      theres no firewall running on both machines im using. so im guessing that this is a matter of address binding. how do i change jboss' address binding?

      Here's the code im using in the client app:

      public static void main(String[] args) {
      try {

      System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.provider.url", "jnp://");
      InitialContext ctx = new InitialContext();
      Object objref = ctx.lookup("helloBean");
      helloBeanRemoteHome beanHome = (helloBeanRemoteHome)PortableRemoteObject.narrow(objref,helloBeanRemoteHome.class);
      helloBeanRemote mrBean = beanHome.create();

      System.out.println("Mr. Bean bilang: "+mrBean.sayHello()+"\n");
      } catch (Exception NamingException) {


        • 1. Re: refused connection
          Vishal Sharma Expert

          First check yr security settings in policy file for the standalone client.
          Secodly binding address for the naming service
          under server/{default/all/minimal}/conf/jboss-service.xml can be chnged here as shon below.

          <mbean code="org.jboss.naming.NamingService"
           <!-- 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.
           <attribute name="CallByValue">true</attribute>
           <!-- The listening port for the bootstrap JNP service. Set this to -1
           to run the NamingService without the JNP invoker listening port.
           <attribute name="Port">1099</attribute>
           <!-- The bootstrap JNP server bind address. This also sets the default
           RMI service bind address. Empty == all addresses
           <attribute name="BindAddress">${jboss.bind.address}</attribute>
           <!-- The port of the RMI naming service, 0 == anonymous -->
           <attribute name="RmiPort">1098</attribute>
           <!-- The RMI service bind address. Empty == all addresses
           <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
           <!-- The thread pool service used to control the bootstrap lookups -->
           <depends optional-attribute-name="LookupPool"