0 Replies Latest reply on Apr 23, 2012 7:31 AM by Gerd Wagner

    Hang or "Stream is closed" error when passing an exception from a remote client to a stateless Session Bean

    Gerd Wagner Newbie

      JBoss AS 7 (latest build)  hangs or runs into a "Stream is closed"-error when an exception is passed as method parameter.

       

      Attached you find a serialized exception (file exc.ser) . To reproduce the problem proceed as follows:

      • Create a Stateless Session Bean with a method that takes a java.lang.Throwable as parameter.
      • Create a client that looks up the remote interface of the bean using InitialContext.lookup()
      • Deserialize the attached file (exc.ser) as follows:
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(<path to attached file>));
        Throwable t = (Throwable) in.readObject();

        To be able to read the object you need
        * jboss-client.jar
        * postgresql-9.0-801.jdbc4.jar (is attached)
        * <jboss-home>\modules\javax\persistence\api\main\ hibernate-jpa-2.0-api-1.0.1.Final.jar
        * All jars in modules <jboss-home>\org\hibernate\main
        in your classpath.

        The postgresql-9.0-801.jdbc4.jar must be registered as a module in your JBoss installation.

      • Call the method passing t as parameter

       

      Sometimes the method call will hang and will never call the method implementation on the server side. Other times on the client will receive the exception below.

       

      Note 1: Also attached is the full server trace of the scenario (file server_exception_ser.log).

       

      Note 2: This probleme may be related to AS7-3402

       

      Stacktrace received by client:

      java.lang.reflect.UndeclaredThrowableException

          at $Proxy0.sendException(Unknown Source)

          at gerd.client.DestTestClient.callDestDirect(DestTestClient.java:66)

          at gerd.client.DestTestClient.main(DestTestClient.java:33)

      Caused by: java.io.IOException: Stream is closed

          at org.xnio.streams.BufferPipeOutputStream.closed(BufferPipeOutputStream.java:61)

          at org.xnio.streams.BufferPipeOutputStream.checkClosed(BufferPipeOutputStream.java:67)

          at org.xnio.streams.BufferPipeOutputStream.write(BufferPipeOutputStream.java:85)

          at org.jboss.remoting3.remote.OutboundMessage.write(OutboundMessage.java:168)

          at java.io.DataOutputStream.write(DataOutputStream.java:71)

          at org.jboss.ejb.client.remoting.AbstractMessageWriter$1.write(AbstractMessageWriter.java:79)

          at java.io.OutputStream.write(OutputStream.java:99)

          at org.jboss.marshalling.OutputStreamByteOutput.write(OutputStreamByteOutput.java:56)

          at org.jboss.marshalling.SimpleDataOutput.flush(SimpleDataOutput.java:311)

          at org.jboss.marshalling.SimpleDataOutput.write(SimpleDataOutput.java:60)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:130)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:809)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)

          at java.lang.Throwable.writeObject(Throwable.java:652)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:188)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1007)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)

          at java.lang.Throwable.writeObject(Throwable.java:652)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:188)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1007)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)

          at java.lang.Throwable.writeObject(Throwable.java:652)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:188)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1007)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)

          at java.lang.Throwable.writeObject(Throwable.java:652)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:188)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1007)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)

          at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)

          at java.lang.Throwable.writeObject(Throwable.java:652)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:188)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1007)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)

          at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)

          at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)

          at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)

          at org.jboss.ejb.client.remoting.MethodInvocationMessageWriter.writeMessage(MethodInvocationMessageWriter.java:105)

          at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.processInvocation(RemotingConnectionEJBReceiver.java:199)

          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)

          at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

          at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)

          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

          ... 3 more

      Caused by: an exception which occurred:

          in field fileName

          in field stackTrace

          in field next

          in field cause

          in field cause

          in field cause

          in field cause

          in object javax.ejb.EJBTransactionRolledbackException@25aa0a15