1 Reply Latest reply on May 7, 2009 12:39 PM by jaikiran pai

    Problem with socket connection to an EJB

    Andreina Grieco Newbie

      I'm using Jboss v4.2
      I have an application that generates threads who do a remote call to a session bean in a method like this

      public void doWork()
       {
      
       Properties p = new Properties( );
       p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
       p.put(Context.PROVIDER_URL,"jnp://"+ip+":1099");
      
       Context context;
       try{
       context = new InitialContext(p);
       NavSenderRemote beanRemote = (NavSenderRemote) context.lookup("WSGeoEAR/NavSenderBean/remote");
      
       Random r = new Random();
       int lat=r.nextInt(100);
       int lon= r.nextInt(100);
      
       beanRemote.setPosition(idUtente, lat, lon);
      
       }catch (NamingException e){
       e.printStackTrace();
       }


      This application works if I run it on the same computer but if I run it on another computer it gives this exception on the client side:



      Exception in thread "Thread-0" org.jboss.remoting.CannotConnectException: Can no
      t get connection to server. Problem establishing socket connection for InvokerLo
      cator [socket://172.19.1.22:3873/]
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transpor
      t(MicroSocketClientInvoker.java:532)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientI
      nvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
      eInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
      opagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
      lientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
      java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
      roxy.java:107)
       at $Proxy0.setPosition(Unknown Source)
       at threads.ClientRMIThread.doWork(ClientRMIThread.java:91)
       at threads.ClientRMIThread.run(ClientRMIThread.java:59)
       at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
      rce)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.createClientS
      ocket(SocketClientInvoker.java:152)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConne
      ction(MicroSocketClientInvoker.java:856)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transpor
      t(MicroSocketClientInvoker.java:525)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientI
      nvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
      eInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
      opagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
      lientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
      java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
      roxy.java:107)
       at $Proxy0.setPosition(Unknown Source)
       at threads.ClientRMIThread.doWork(ClientRMIThread.java:91)
       at threads.ClientRMIThread.run(ClientRMIThread.java:59)
       at java.lang.Thread.run(Unknown Source)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
      eInterceptor.java:74)
       ... 12 more
      Caused by: java.net.SocketException: Connection reset
       at java.net.SocketInputStream.read(Unknown Source)
       at java.io.BufferedInputStream.fill(Unknown Source)
       at java.io.BufferedInputStream.read1(Unknown Source)
       at java.io.BufferedInputStream.read(Unknown Source)
       at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
       at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
       at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Sour
      ce)
       at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
       at java.io.ObjectInputStream.<init>(Unknown Source)
       at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.<init>(Ob
      jectInputStreamWithClassLoader.java:95)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.c
      reateInput(JavaSerializationManager.java:54)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.getM
      arshallingStream(SerializableUnMarshaller.java:72)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.getM
      arshallingStream(SerializableUnMarshaller.java:55)
       at org.jboss.remoting.transport.socket.ClientSocketWrapper.createInputSt
      ream(ClientSocketWrapper.java:185)
       at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams
      (ClientSocketWrapper.java:164)
       at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(Client
      SocketWrapper.java:66)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
      rce)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.createClientS
      ocket(SocketClientInvoker.java:152)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConne
      ction(MicroSocketClientInvoker.java:856)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transpor
      t(MicroSocketClientInvoker.java:525)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientI
      nvoker.java:122)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
      eInterceptor.java:62)
       ... 12 more
      



      I have already checked that
      -Jboss runs with -b 0.0.0.0
      -the firewalls are deactivated
      -the ip is correct
      any ideas?