Uploaded image for project: 'JBoss Remoting'
  1. JBoss Remoting
  2. JBREM-1302

Can't invoke remote object if server bind address is 0.0.0.0

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.5.4.SP3
    • Fix Version/s: None
    • Component/s: transport
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      1. Start Jboss bound to 0.0.0.0
      2. Deploy MBean for example
      3. Make remote call to it

      Show
      1. Start Jboss bound to 0.0.0.0 2. Deploy MBean for example 3. Make remote call to it
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Workaround is set jboss bind address for on of host's IP. But it doesn't work for multihome solutions where 0.0.0.0 should be set.

      Show
      Workaround is set jboss bind address for on of host's IP. But it doesn't work for multihome solutions where 0.0.0.0 should be set.
    • Estimated Difficulty:
      Medium

      Description

      When jboss bind address is set to `0.0.0.0` remote client gets exception while trying to invoke remote object's method:
      java.rmi.ConnectException: Connection refused to host: lx4-schernov.nn.five9.com; nested exception is:
      java.net.ConnectException: Connection refused: connect
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
      at org.jboss.remoting.transport.rmi.RMIServerInvoker_Stub.transport(Unknown Source)
      at org.jboss.remoting.transport.rmi.RMIClientInvoker.callTransport(RMIClientInvoker.java:648)
      at org.jboss.remoting.transport.rmi.RMIClientInvoker.access$100(RMIClientInvoker.java:78)
      at org.jboss.remoting.transport.rmi.RMIClientInvoker$1.run(RMIClientInvoker.java:402)
      at org.jboss.util.threadpool.RunnableTaskWrapper.run(RunnableTaskWrapper.java:147)
      at org.jboss.util.threadpool.BasicThreadPool.executeOnThread(BasicThreadPool.java:473)
      at org.jboss.util.threadpool.BasicThreadPool.runTaskWrapper(BasicThreadPool.java:201)
      at org.jboss.remoting.transport.rmi.RMIClientInvoker.transport(RMIClientInvoker.java:420)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:169)
      at org.jboss.remoting.Client.invoke(Client.java:2070)
      at org.jboss.remoting.Client.invoke(Client.java:879)
      at org.jboss.remoting.Client.invoke(Client.java:867)
      at org.jboss.remoting.transporter.TransporterClient.invoke(TransporterClient.java:479)
      at $Proxy0.getMySumHost(Unknown Source)
      at test.Main.main(Main.java:45)
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:193)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      at java.net.Socket.connect(Socket.java:525)
      at java.net.Socket.connect(Socket.java:475)
      at java.net.Socket.<init>(Socket.java:372)
      at java.net.Socket.<init>(Socket.java:186)
      at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:206)
      at org.jboss.remoting.transport.rmi.RemotingRMIClientSocketFactory.createSocketPrivate(RemotingRMIClientSocketFactory.java:333)
      at org.jboss.remoting.transport.rmi.RemotingRMIClientSocketFactory.createSocket(RemotingRMIClientSocketFactory.java:210)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
      ... 18 more

      It happens because RemotingRMIClientSocketFactory had been created with wrong ('0.0.0.0') host name which becomes effective host while creating socket:
      log:
      328 [main] TRACE org.jboss.remoting.transport.rmi.RemotingRMIClientSocketFactory - host: lx4-schernov.nn.five9.com, effective host: 0.0.0.0, port: 47952

      source:
      public Socket createSocket(String host, final int port) throws IOException
      176 {
      ...
      181 final String effectiveHost = hostName != null ? hostName : host;

      While creating factory it should be checked, that host name is not broadcast or localhost address, to make client's locatorUri mandatory for such cases.

      Client source code:
      String address = "remote.host.com";

      Properties props = new Properties();
      props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      props.put(InitialContext.PROVIDER_URL, "jnp://" + address + ":1099");
      props.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

      InitialContext context = new InitialContext(props);

      Object tmp = context.lookup("remote/subsystem/Object");

      ObjectInf object = (ObjectInf) tmp;

      object.doJob(); // here exception it thrown

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ron_sigal Ronald Sigal
                Reporter:
                chernser Sergey Chernov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: