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

    refused connection

    bungrudi

      hello,

      i get

      javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; 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://192.168.0.3:1099");
      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) {
      System.out.println(NamingException.getMessage());
      NamingException.printStackTrace();
      }
      }


      thanks

        • 1. Re: refused connection

          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"
           name="jboss:service=Naming">
           <!-- 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"
           proxy-type="attribute">jboss.system:service=ThreadPool</depends>
           </mbean>


          Vishal.
          http://vashistvishal.blogspot.com