Announcement Announcement Module
Collapse
No announcement yet.
java.io.NotSerializableException on transition on-exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.io.NotSerializableException on transition on-exception

    Dear All,
    I have noticed that using spring web-flow (>= 1.02 version) on transitions which
    have the tag "transition on-exception" this exception occurs:


    10:00:50,015 ERROR [DispatcherPortlet] Could not complete request
    org.springframework.webflow.execution.repository.c ontinuation.ContinuationCreationException: Could not serialize flow execution; make sure all objects stored in flow or flash scope are serializable; nested exception is java.io.NotSerializableException: org.springframework.binding.method.MethodSignature
    Caused by:
    java.io.NotSerializableException: org.springframework.binding.method.MethodSignature
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1081)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1375)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1347)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1375)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1347)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
    at java.util.HashMap.writeObject(HashMap.java:1039)
    at sun.reflect.GeneratedMethodAccessor84.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:917)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1339)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1375)
    at java.io.ObjectOutputStream.defaultWriteObject(Obje ctOutputStream.java:391)
    at org.springframework.webflow.core.collection.LocalA ttributeMap.writeObject(LocalAttributeMap.java:307 )
    at sun.reflect.GeneratedMethodAccessor625.invoke(Unkn own Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:917)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1339)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
    at org.springframework.webflow.engine.impl.FlowSessio nImpl.writeExternal(FlowSessionImpl.java:160)
    at java.io.ObjectOutputStream.writeExternalData(Objec tOutputStream.java:1310)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1288)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
    at java.util.LinkedList.writeObject(LinkedList.java:7 55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:917)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1339)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
    at org.springframework.webflow.engine.impl.FlowExecut ionImpl.writeExternal(FlowExecutionImpl.java:482)
    at java.io.ObjectOutputStream.writeExternalData(Objec tOutputStream.java:1310)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1288)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
    at org.springframework.webflow.execution.repository.c ontinuation.SerializedFlowExecutionContinuation.se rialize(SerializedFlowExecutionContinuation.java:1 78)
    at org.springframework.webflow.execution.repository.c ontinuation.SerializedFlowExecutionContinuation.<i nit>(SerializedFlowExecutionContinuation.java:70)
    at org.springframework.webflow.execution.repository.c ontinuation.SerializedFlowExecutionContinuationFac tory.createContinuation(SerializedFlowExecutionCon tinuationFactory.java:55)
    at org.springframework.webflow.execution.repository.c ontinuation.ContinuationFlowExecutionRepository.pu tFlowExecution(ContinuationFlowExecutionRepository .java:178)
    at org.springframework.webflow.executor.FlowExecutorI mpl.resume(FlowExecutorImpl.java:249)
    at org.springframework.webflow.executor.mvc.PortletFl owController.handleActionRequestInternal(PortletFl owController.java:193)
    at org.springframework.web.portlet.mvc.AbstractContro ller.handleActionRequest(AbstractController.java:1 91)
    at org.springframework.web.portlet.mvc.SimpleControll erHandlerAdapter.handleAction(SimpleControllerHand lerAdapter.java:46)
    at org.springframework.web.portlet.DispatcherPortlet. doActionService(DispatcherPortlet.java:677)
    at org.springframework.web.portlet.FrameworkPortlet.p rocessRequest(FrameworkPortlet.java:458)
    at org.springframework.web.portlet.FrameworkPortlet.p rocessAction(FrameworkPortlet.java:440)
    at com.liferay.portal.kernel.servlet.PortletServlet.s ervice(PortletServlet.java:88)
    ....

    I have resolved this problem implementing Serializable interface for classes below:

    org.springframework.binding.method.MethodSignature
    org.springframework.binding.method.Parameters
    org.springframework.binding.method.Parameter
    org.springframework.binding.expression.support.Ogn lExpression

    Do you have any suggestions?

    Christian

  • #2
    Can you paste the code of the flow in which this occures?

    Comment


    • #3
      Yes,

      Class MergeNotSupportedException extends RuntimeException

      <action-state id="mergeSection">
      <bean-action bean="sectionService" method="merge">
      <method-arguments>
      <argument expression="${requestParameters.elementId}" parameter-type="long" />
      </method-arguments>
      </bean-action>
      <transition on="success" to="manageElement" />
      <transition on-exception="it.smit.service.exception.MergeNotSuppo rtedException" to="listElement" />
      </action-state>

      Comment


      • #4
        Strange.. Does this error keep occuring when you remove the on-exception transition?
        Implementing Serializable for the classes you mentioned isn't the right thing to do..

        Comment


        • #5
          Hi,
          I reckon that adding the Serializable interface to the previous classes isn't the real solution to the problem.
          But, I would like to underline that it always happen when the type of transition is "on-exception" (and this doesn't happen using the 1.01 version).
          Moreover, this behaviour doesn't happen in other transaction types.

          If you read at this link:

          http://opensource.atlassian.com/proj...browse/SWF-269

          you can notice that from 1.02 version was introduced a new feature which resolves transitions dynamically when an on-exception occurs.

          I suppose that this new feature might be the cause of this problem.

          Do you think so?

          Christian

          Comment


          • #6
            Is your MergeNotSupportedException serializable?
            Can you post the code of that exception?

            Keep in mind that *all* Java exceptions should be serializable (Throwable implements Serializable), so you cannot have references to non-serializable objects from inside an exception!

            The SWF TransitionExecutingStateExceptionHandler will put the exception it handles in flash scope, which could lead to this kind of problem.

            Also look at this issue:
            http://opensource.atlassian.com/proj...browse/SWF-280

            Erwin
            Last edited by klr8; May 4th, 2007, 03:25 AM.

            Comment


            • #7
              Hi,
              I have created an example modifying the birthdate example:

              Service interface
              -------------------------------------
              package org.springframework.webflow.samples.birthdate.serv ice;

              public interface ServiceBean {
              void testIt();
              }
              --------------------------------------
              Service Exception

              ---------------------------------------
              package org.springframework.webflow.samples.birthdate.serv ice.exception;

              public class MyGeneratedException extends RuntimeException{

              private static final long serialVersionUID = 1L;

              }
              -------------------------------------
              Service Implementation
              -----------------------------------
              package org.springframework.webflow.samples.birthdate.serv ice.impl;

              import org.springframework.webflow.samples.birthdate.serv ice.ServiceBean;
              import org.springframework.webflow.samples.birthdate.serv ice.exception.MyGeneratedException ;
              -------------------------------------
              public class ServiceBeanImpl implements ServiceBean{


              public void testIt()
              {
              throw new MyGeneratedException ();
              }
              }
              ---------------------------
              birthdate.xml
              -------------------------------

              <!-- Display the first input form view -->
              <view-state id="enterBirthdate" view="birthdateForm">
              <!--
              Prepare to display a new form. Initializes the backing "form object" and installs property
              editors to format form field values.
              -->
              <render-actions>
              <action bean="formAction" method="setupForm" />
              </render-actions>
              <transition on="submit" to="errorExample" />
              </view-state>

              <action-state id="errorExample">
              <bean-action bean="serviceBean" method="testIt">
              </bean-action>
              <transition on="success" to="processBirthdateFormSubmit" />
              <transition on-exception="org.springframework.webflow.samples.bir thdate.service.exception.MyGeneratedException" to="processBirthdateFormSubmit" />
              </action-state>

              -------------------------------------------
              I have posted the src example folder.


              Christian

              Comment


              • #8
                I'll take a look at this and report back.

                Erwin

                Comment


                • #9
                  Okay, I was able to reproduce and resolve the problem.

                  The problem was that MethodInvocationException was holding on to objects that were not serializable, for instance MethodSignature.

                  I've committed fixes for both 1.0.4 and 1.1 that make these non-serializable fields transient.

                  Grab the next nightly build and give that a try:
                  http://static.springframework.org/do...hp?project=SWF

                  Erwin

                  Comment


                  • #10
                    for those of us using 1.0.2

                    Howdy,
                    I'm experiencing the same error on 1.0.2. I don't want to switch to 1.0.4 because they use different vesions of spring and spring -binding. Can that fix be applied to 1.0.2 as well?
                    --jim

                    Comment


                    • #11
                      SWF 1.0.2 Fix

                      Is there anyway we can get this fixed in version 1.0.2 of SWF??

                      Upgrading to Spring 2.0.4 is not really an option at this point in my current situation.

                      Please let me know if there is anything you can do. Thanks!!!

                      Comment


                      • #12
                        Just grab a 1.0.4 snapshot. There is no need to upgrade to Spring 2.0.4.

                        Erwin

                        Comment


                        • #13
                          spring-webflow-1.0.4-SNAPSHOT seems not resolve the problem.

                          I'm also get the similar exception(see stacktrace below),
                          I'm using Spring2.0.5 & spring-webflow-1.0.4-SNAPSHOT-20070613-48.zip as suggested.
                          java.io.NotSerializableException: org.springframework.binding.method.MethodSignature
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1081)
                          at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1375)
                          at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1347)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1375)
                          at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1347)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
                          at java.util.HashMap.writeObject(HashMap.java:1039)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:585)
                          at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:917)
                          at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1339)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1375)
                          at java.io.ObjectOutputStream.defaultWriteObject(Obje ctOutputStream.java:391)
                          at org.springframework.webflow.core.collection.LocalA ttributeMap.writeObject(LocalAttributeMaap.java:30 7)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:585)
                          at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:917)
                          at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1339)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
                          at org.springframework.webflow.engine.impl.FlowSessio nImpl.writeExternal(FlowSessionImpl.java:160)
                          at java.io.ObjectOutputStream.writeExternalData(Objec tOutputStream.java:1310)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1288)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
                          at java.util.LinkedList.writeObject(LinkedList.java:7 55)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:585)
                          at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:917)
                          at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1339)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1290)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
                          at org.springframework.webflow.engine.impl.FlowExecut ionImpl.writeExternal(FlowExecutionImpl.java:482)
                          at java.io.ObjectOutputStream.writeExternalData(Objec tOutputStream.java:1310)
                          at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1288)
                          at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1079)
                          at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:302)
                          at org.springframework.webflow.execution.repository.c ontinuation.SerializedFlowExecutionContinuation.se rialize(SerializedFlowExecutionContinuation.java:1 78)
                          at org.springframework.webflow.execution.repository.c ontinuation.SerializedFlowExecutionContinuation.<i nit>(SerializedFlowExecutionContinuation.java:70)
                          at org.springframework.webflow.execution.repository.c ontinuation.SerializedFlowExecutionContinuationFac tory.createContinuation(SerializedFlowExecutionCon tinuationFactory.java:55)
                          at org.springframework.webflow.execution.repository.c ontinuation.ContinuationFlowExecutionRepository.pu tFlowExecution(ContinuationFlowExecutionRepository .java:178)
                          at org.springframework.webflow.executor.FlowExecutorI mpl.resume(FlowExecutorImpl.java:249)
                          at org.springframework.webflow.executor.support.FlowR equestHandler.handleFlowRequest(FlowRequestHandler .java:115)
                          at org.springframework.webflow.executor.mvc.FlowContr oller.handleRequestInternal(FlowController.java:17 2)
                          at org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:153)
                          at org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:48)
                          at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:857)
                          at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:792)
                          at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:461)
                          at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:426)
                          at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
                          at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
                          at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
                          at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
                          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)
                          at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
                          at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
                          at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
                          at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
                          at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:39)
                          at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:153)
                          at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContextValve.java:59)
                          at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
                          at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
                          at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
                          at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
                          at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:856)
                          at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:744)
                          at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
                          at org.apache.tomcat.util.net.MasterSlaveWorkerThread .run(MasterSlaveWorkerThread.java:112)
                          at java.lang.Thread.run(Thread.java:595)

                          Comment


                          • #14
                            Are you sure you did your upgrade to 1.0.4 nightly properly? That the new jars are being picked up? Make sure particularly that you update the version of spring-binding as that's where this fix is.

                            Keith

                            Comment


                            • #15
                              it indeed is 1.0.4.

                              yes, 1.0.4 does resolve the problem, sorry for the confusion.
                              Last edited by lipman; Jun 13th, 2007, 09:32 PM. Reason: recall

                              Comment

                              Working...
                              X