6 Replies Latest reply on Sep 18, 2009 10:28 AM by andrei.harangus

    NotSerializableException: org.jboss.ws.core.soap.SOAPFaultIm

    lafr

      I'm using JBoss-4.2.4GA with jbossws-3.0.1-native-2.0.4.GA.

      I used wsconsume to generate the client artefacts from an MS Dynamics Axapta 2009 instance.
      Calling a Webservice I get this exception:

      java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.jboss.ws.core.soap.SOAPFaultImpl
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:945)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:633)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.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(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       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.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy3.sendAggregatedValues(Unknown Source)
      ...
      Caused by: java.io.NotSerializableException: org.jboss.ws.core.soap.SOAPFaultImpl
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
       at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
       at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
       at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
       at java.lang.Throwable.writeObject(Throwable.java:648)
       at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
       at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.sendObjectVersion2_2(JavaSerializationManager.java:120)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.sendObject(JavaSerializationManager.java:95)
       at org.jboss.remoting.marshal.serializable.SerializableMarshaller.write(SerializableMarshaller.java:120)
       at org.jboss.remoting.transport.socket.ServerThread.versionedWrite(ServerThread.java:841)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:641)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:406)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)
      

      All operations have a Fault message
      <wsdl:binding name="BasicHttpBinding_GeneralJournalService" type="tns:GeneralJournalService">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
       <wsdl:operation name="create">
       <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/create"
       style="document"/>
       <wsdl:input name="GeneralJournalServiceCreateRequest">
       <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="GeneralJournalServiceCreateResponse">
       <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="AifFaultFault">
       <soap:fault name="AifFaultFault" use="literal"/>
       </wsdl:fault>
       </wsdl:operation>
       <wsdl:operation name="find">
       <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/find"
       style="document"/>
       <wsdl:input name="GeneralJournalServiceFindRequest">
       <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="GeneralJournalServiceFindResponse">
       <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="AifFaultFault">
       <soap:fault name="AifFaultFault" use="literal"/>
       </wsdl:fault>
       </wsdl:operation>
       <wsdl:operation name="read">
       <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/read"
       style="document"/>
       <wsdl:input name="GeneralJournalServiceReadRequest">
       <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="GeneralJournalServiceReadResponse">
       <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="AifFaultFault">
       <soap:fault name="AifFaultFault" use="literal"/>
       </wsdl:fault>
       </wsdl:operation>
       </wsdl:binding>
      
      which probably is part of the problem.
      It's the first time I try to consume a WS defined this way.

      What's missing or wrong here?

        • 1. Re: NotSerializableException: org.jboss.ws.core.soap.SOAPFau

          Do you mean the SOAPFault is generated on the server side? The fault cant be generated on the client side.

          If you are controlling the server side code, make sure that the member properties of the exception that you are throwing (wrapped by the SOAPFaultException) are all serializable.

          • 2. Re: NotSerializableException: org.jboss.ws.core.soap.SOAPFau
            lafr

            A Fault occurs on the server side while executing the webservice request from my client.
            The server side code is not under my control, its under the control of Microsoft.
            They give back a soap message containing a fault like it is defined in the wsdl contract.
            Example:

            2009-05-27 21:40:22,329 TRACE [org.jboss.ws.core.MessageTrace#traceMessage] Incoming Response Message
            <s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>
             <s:Body>
             <s:Fault xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>
             <faultcode>s:Client</faultcode>
             <faultstring xml:lang='en-US'>Request Failed. See the Exception Log for details.</faultstring>
             <detail>
             <AifFault xmlns='http://schemas.microsoft.com/dynamics/2008/01/documents/Fault' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
             <CustomDetailXml i:nil='true'/>
             <FaultMessageListArray i:nil='true'/>
             </AifFault>
             </detail>
             </s:Fault>
             </s:Body>
            </s:Envelope>
            


            JBossWS was not able to read or unmarshal such a message into the corresponding objects.
            I downloaded the the code and added "implements Serializable" to SOAPFaultImpl and a few others and now the communication between JBossWS-Client and the MS software based on WCF (Windows Communication Foundation) on the server side.

            I wonder that nobody had the problem before and that the released versions of JBossWS are not capable of reading answers like the one above.


            • 3. Re: NotSerializableException: org.jboss.ws.core.soap.SOAPFau
              asoldano

              Hi lafr,
              first of all thanks for posting this. Is the exception stacktrace you posted here complete? It's not clear to me when that serialization actually happen.
              Knowing a bit more about the ws client might help understanding your specific issue.
              Also knowing what else you changed in the sources to solve the serialization issue would help.
              thanks

              • 4. Re: NotSerializableException: org.jboss.ws.core.soap.SOAPFau
                lafr

                I downloaded jbossws-3.0.1-native-2.0.4.GA-src
                and modified src/main/java/org/jboss/ws/core/soap/SOAPFaultElementImpl.java
                and
                src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java
                adding an "implements java.io.Serializable" to their class definition.
                This helped me to avoid the NotSerializableException.

                In the scenario the problem problem occurred, there are three apps involved.
                The MS Axapta system as the WS-provider.
                An EAR / EJB3 app as the WS-consumer.
                And an standalone java app as the driver of this (unit test) calling the EJB3 session beans via their remote interface.

                The WS provider gets an exception and send this to WS consumer using a SOAPFault.
                The WS consumer does not catch the exception, so it has to be transferred to the client.
                And as this is a remote client the SOAPFault has to serialized.
                And there the Exception occurred while trying to send the SOAPFault from JBoss-Server to the standalone client app using serialization.

                • 5. Re: NotSerializableException: org.jboss.ws.core.soap.SOAPFau

                  Using JBoss 4.2.3GA, jbossws 3.0.1
                  Have the same issue basically.
                  Has this been fixed / is it considered "fixable"?

                  org.jboss.soa.esb.couriers.CourierMarshalUnmarshalException: Failed to serialize ESB Message.
                  at org.jboss.internal.soa.esb.couriers.JmsCourier.deliver(JmsCourier.java:203)
                  at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.deliver(TwoWayCourierImpl.java:189)
                  at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.messageTo(ActionProcessingPipeline.java:860)
                  at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.faultTo(ActionProcessingPipeline.java:810)
                  at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:665)
                  at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:585)
                  at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:419)
                  at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:548)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                  at java.lang.Thread.run(Thread.java:619)
                  Caused by: java.io.IOException: Util.serialize caught XMLStreamException:
                  at org.jboss.soa.esb.util.Util.serialize(Util.java:197)
                  at org.jboss.internal.soa.esb.couriers.JmsCourier.deliver(JmsCourier.java:197)
                  ... 10 more
                  Caused by: javax.xml.stream.XMLStreamException: org.jboss.soa.esb.MarshalException: Failed to encode value
                  at org.jboss.internal.soa.esb.message.format.xml.marshal.MarshalUnmarshalManager.marshal(MarshalUnmarshalManager.java:149)
                  at org.jboss.internal.soa.esb.message.format.xml.BodyImpl.writeChildContent(BodyImpl.java:146)
                  at org.jboss.internal.soa.esb.util.stax.ElementContent.writeContent(ElementContent.java:41)
                  at org.jboss.internal.soa.esb.util.stax.StreamHelper.writeElement(StreamHelper.java:125)
                  at org.jboss.internal.soa.esb.message.format.xml.MessageImpl.writeChildContent(MessageImpl.java:230)
                  at org.jboss.internal.soa.esb.util.stax.ElementContent.writeContent(ElementContent.java:41)
                  at org.jboss.soa.esb.util.Util.serialize(Util.java:188)
                  ... 11 more
                  Caused by: org.jboss.soa.esb.MarshalException: Failed to encode value
                  at org.jboss.internal.soa.esb.message.format.xml.marshal.SerializedMarshalUnmarshalPlugin.marshal(SerializedMarshalUnmarshalPlugin.java:87)
                  at org.jboss.internal.soa.esb.message.format.xml.marshal.MarshalUnmarshalManager.marshal(MarshalUnmarshalManager.java:145)
                  ... 17 more
                  Caused by: java.io.NotSerializableException: org.jboss.ws.core.soap.SOAPFaultImpl
                  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
                  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
                  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
                  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
                  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
                  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
                  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
                  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
                  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
                  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
                  at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
                  at java.lang.Throwable.writeObject(Throwable.java:648)
                  at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:597)
                  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
                  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
                  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
                  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
                  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
                  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
                  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
                  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
                  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
                  at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
                  at java.lang.Throwable.writeObject(Throwable.java:648)
                  at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:597)
                  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
                  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
                  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
                  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
                  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
                  at org.jboss.internal.soa.esb.util.Encoding.encodeObject(Encoding.java:59)
                  at org.jboss.internal.soa.esb.message.format.xml.marshal.SerializedMarshalUnmarshalPlugin.marshal(SerializedMarshalUnmarshalPlugin.java:83)
                  ... 18 more
                  


                  • 6. Re: NotSerializableException: org.jboss.ws.core.soap.SOAPFau

                    Sorry, it's jbossws 3.1.0