4 Replies Latest reply on Nov 20, 2007 3:08 PM by skomarla

    obtaining remote ejb ref via localhost lookup?

    skomarla

      Hi Guys,

      I have an issue with looking up a remote ejb via JNDI lookup when I use localhost instead of the actual machine name. I know that in a real environment, one would never use localhost, but we have a large team of developers that are used to just using localhost that would be somewhat annoyed if I broke this on them.

       m_providerUrl = "socket://localhost:3873";
      
       .... <snip>
      
       Properties properties = new Properties();
      
       properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.JBossRemotingContextFactory");
       properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       properties.setProperty(Context.PROVIDER_URL, m_providerUrl);
      


      If I replace the above provider url like below, the remote ejb lookup works.

       m_providerUrl = "socket://skomarla:3873";
      


      The exception I get is
      org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://localhost:3873/]
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1544)
       at org.jboss.remoting.Client.invoke(Client.java:530)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:48)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
       at $Proxy0.lookup(Unknown Source)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
       at javax.naming.InitialContext.lookup(Unknown Source)
       <snip>
      Caused by: java.net.ConnectException: Connection refused: connect
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.PlainSocketImpl.doConnect(Unknown Source)
       at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
       at java.net.PlainSocketImpl.connect(Unknown Source)
       at java.net.SocksSocketImpl.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:187)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:796)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:521)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1544)
       at org.jboss.remoting.Client.invoke(Client.java:530)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:48)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
       at $Proxy0.lookup(Unknown Source)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
       at javax.naming.InitialContext.lookup(Unknown Source)
       <snip>
      


      netstat -an | grep 3873 reports only listening on the actual ip and not 0.0.0.0:3873.
       Proto Local Address Foreign Address State
       TCP 10.20.20.37:3873 0.0.0.0:0 LISTENING
      


      Is this just a matter configuring JBoss remoting? If so, what would that configuration change be such that the appserver listens on both localhost and actual machine's ip?

      Thanks for the help