8 Replies Latest reply on Dec 22, 2008 9:33 AM by imranpariyani

    Problem during marshalling/unmarshalling

    msaeed

      Hi

      I'm using JBoss 4.0.3. From my session bean I'm writing an object from the client and then trying to read it. An exception is thrown while returning from the method call that reads the object. The persistent object being returned has a List of another persistent object which is retrieve by LEFT FETCH JOIN.
      Any input will be appreciated. The exception is as follows:

      java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.lookupOrder(Unknown Source)
      at tut1client.client.Main.main(Main.java:56)
      Caused by: java.rmi.ConnectException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
      java.io.InvalidClassException: org.hibernate.collection.AbstractPersistentCollection; local class incompatible: stream classdesc serialVersionUID = 7602608801868099635, local class serialVersionUID = -6208749127098131726
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:264)
      at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:112)
      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(InvokeRemoteInterceptor.java:41)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:41)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:88)
      ... 2 more
      Caused by: java.io.InvalidClassException: org.hibernate.collection.AbstractPersistentCollection; local class incompatible: stream classdesc serialVersionUID = 7602608801868099635, local class serialVersionUID = -6208749127098131726
      at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:107)
      at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:73)
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:242)
      ... 14 more

        • 1. Re: Problem during marshalling/unmarshalling
          triathlon98

          It seems you have different versions of the hibernate jars on the client and server side.

          Joachim

          • 2. Re: Problem during marshalling/unmarshalling
            msaeed

            Hi Joachim,

            All is good now. Thanks for the reply.

            Manny

            • 3. Re: Problem during marshalling/unmarshalling

              i get the same error but i can't resolve it :( plz help
              my hibernate jars are the same ...
              error code :
              [CODE]
              Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
              at $Proxy0.add(Unknown Source)
              at org.jboss.tutorial.stateless.client.Client.main(Client.java:12)
              Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
              java.io.OptionalDataException
              at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306)
              at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
              at org.jboss.remoting.Client.invoke(Client.java:525)
              at org.jboss.remoting.Client.invoke(Client.java:488)
              at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
              at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
              at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
              at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:78)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
              at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
              ... 2 more
              Caused by: java.io.OptionalDataException
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1310)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
              at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
              at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
              at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
              ... 14 more
              [/CODE]

              • 4. Re: Problem during marshalling/unmarshalling
                justin033

                 

                "msaeed" wrote:
                Hi Joachim,

                All is good now. Thanks for the reply.

                Manny



                can u give us the steps how to slove this problem???
                Just remove the extra of hibernate jar???

                • 5. Re: Problem during marshalling/unmarshalling
                  ocsamuel

                  I also get this error...how to resolve it?
                  Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
                  java.io.OptionalDataException

                  • 6. Re: Problem during marshalling/unmarshalling
                    imranpariyani

                    hi

                    ocsamuel were u able to solve this problem ? i am also getting the same error .. checked the client jars twice .. they are the same .. below is the stack trace .. i am streaming the object from jboss to tomcat ... when i print the object in jboss console it seems to be fine ...

                    and the funny thing is i get this exception not always but only sometimes ..

                    123386 [pool-18-thread-1] ERROR org.jboss.remoting.transport.socket.SocketClientInvoker - Got marshalling exception, exiting
                     java.io.OptionalDataException
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
                     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
                     at java.util.LinkedList.readObject(LinkedList.java:776)
                     at sun.reflect.GeneratedMethodAccessor228.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.reflect.Method.invoke(Method.java:585)
                     at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)
                     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
                     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                     at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
                     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
                     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                     at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
                     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
                     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
                     at java.util.ArrayList.readObject(ArrayList.java:587)
                     at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.reflect.Method.invoke(Method.java:585)
                     at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)
                     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
                     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                     at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
                     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
                     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
                     at java.util.HashSet.readObject(HashSet.java:278)
                     at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    


                    any help will be appreciated

                    Imran

                    • 7. Re: Problem during marshalling/unmarshalling
                      lincao123

                      Hi, imranpariyani,

                      Recently I got the same error while invoking remote ejb from jboss 4.0.5 to 4.2.0. Can you share your solution with me? Thanks a lot!

                      Lin

                      • 8. Re: Problem during marshalling/unmarshalling
                        imranpariyani

                         

                        "lincao123" wrote:
                        Hi, imranpariyani,

                        Recently I got the same error while invoking remote ejb from jboss 4.0.5 to 4.2.0. Can you share your solution with me? Thanks a lot!

                        Lin



                        Hi lin

                        Well for me the problem was an object somewhere within the entity which was not Serializable .. i was passing that along with the entity ..

                        if your having the same stacktrace (i.e with ObjectInputStream) then i guess u also must be passing an object which is not Serializable along with the entity .. and if there is something with SearialversionUID then it has to do with different versions of hibernate jars

                        I guess u might have already found the problem but just in case if someone else fumbles upon the same

                        Regards

                        Imran