3 Replies Latest reply on Mar 5, 2007 12:25 PM by Tom Elrod

    SocketTimeout in client

    Mahesh Patil Newbie

      Hello All

      i am connecting to server using java client, after setting socket time out attribute in "invokers-service.xml" to 300000 milli sec. i am getting the Socket timeout error after 60 seconds of waiting time(default time out value).
      Server Version : Jboss-4.0.3sp1

      For information i have pasted complete stack strace below.
      if any configuration is missed out in server/ client, please let me know.

      java.rmi.ConnectException: Failed to communicate. Problem during marshalling/un
      marshalling; nested exception is:
      java.net.SocketTimeoutException: Read timed out
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(Soc
      at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.jav
      at org.jboss.remoting.Client.invoke(Client.java:226)
      at org.jboss.remoting.Client.invoke(Client.java:189)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
      at $Proxy5.getTreeObject(Unknown Source)

      Caused by: java.net.SocketTimeoutException: Read timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(Unknown Source)
      at java.io.BufferedInputStream.fill(Unknown Source)
      at java.io.BufferedInputStream.read(Unknown Source)
      at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
      at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source)
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Sourc
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(Soc
      ... 27 more

      Thanks in advance

      Thanks and Regards

        • 1. Re: SocketTimeout in client
          Tom Elrod Master

          Will need to make sure the timeout is getting set for the client. If are using remoting discovery to get the locator url for the client to use, then need to make sure the isParam attribute is set to true in your invokers-service.xml. For example:

          <attribute name="timeout" isParam="true">60000</attribute>

          This way, when the client gets the locator url with the timeout built in as a url parameter (i.e. socket://myhost:3453/?timeout=60000).

          If you are creating the remoting Client class yourself and passing the locator url, will need to make sure you pass the timeout value. More info on this at http://labs.jboss.com/portal/jbossremoting/docs/guide/ch05.html#d0e668.

          BTW, if using older version of remoting, the attribute is 'socketTimeout' and for 2.x is 'timeout'.

          • 2. Re: SocketTimeout in client
            Mahesh Patil Newbie

            Hello Mr. Tom,

            i am using following code to get the remote objects,
            Hashtable<Object,String> props = new Hashtable<Object,String> ();
            props.put(InitialContext.PROVIDER_URL, "jnp://");
            props.put("java.naming.factory.url.pkgs", "org.jboss.naming");

            InitialContext ctx = new InitialContext(props);
            objSecurity = (Security) ctx.lookup(SecurityRemote.class.getName());

            after setting the timeout attribute in invoker-service.xml to 120,000 it is taking the 60000 milli sec as default and it throwing timeout exception after 60000 ms.

            please let me know any other options to get the remote objects, so i can avoid the timeout exception.

            • 3. Re: SocketTimeout in client
              Tom Elrod Master

              Guess the real question is what is SecurityRemote? If it is an object that you created which creates a remoting Client instance, then need to make sure the locator url used when creating that remoting Client contains the client timeout.