Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1463

JpaFlowExecutionListener shouldn't assume that EntityManager is Serializable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      JpaFlowExecutionListener stores EntityManager into Flow Scope, assuming it will be Serializable (each object stored into this scope should be Serializable, according to the documentation). This assumption is wrong, EntityManager doesn't extend Serializable, and doesn't have to implement this interface.

      Using EclipseLink 2.2 I'm getting following exception in this case:

      org.springframework.webflow.execution.repository.snapshot.SnapshotCreationException: Could not serialize flow execution; make sure all objects stored in flow or flash scope are serializable
      org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshot.<init>(SerializedFlowExecutionSnapshot.java:75)
      org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshotFactory.createSnapshot(SerializedFlowExecutionSnapshotFactory.java:70)
      org.springframework.webflow.execution.repository.snapshot.AbstractSnapshottingFlowExecutionRepository.snapshot(AbstractSnapshottingFlowExecutionRepository.java:75)
      org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.putFlowExecution(DefaultFlowExecutionRepository.java:126)
      org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:145)
      org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
      ...
      java.io.NotSerializableException: org.eclipse.persistence.internal.jpa.EntityManagerImpl
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
      java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      ...
      java.util.HashMap.writeObject(HashMap.java:1001)
      ...
      org.springframework.webflow.core.collection.LocalAttributeMap.writeObject(LocalAttributeMap.java:327)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...
      org.springframework.webflow.engine.impl.FlowSessionImpl.writeExternal(FlowSessionImpl.java:154)
      ...
      org.springframework.webflow.engine.impl.FlowExecutionImpl.writeExternal(FlowExecutionImpl.java:312)
      ...
      org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshot.serialize(SerializedFlowExecutionSnapshot.java:173)
      org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshot.<init>(SerializedFlowExecutionSnapshot.java:70)
      org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshotFactory.createSnapshot(SerializedFlowExecutionSnapshotFactory.java:70)
      org.springframework.webflow.execution.repository.snapshot.AbstractSnapshottingFlowExecutionRepository.snapshot(AbstractSnapshottingFlowExecutionRepository.java:75)
      org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.putFlowExecution(DefaultFlowExecutionRepository.java:126)
      org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:145)
      org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)

        Attachments

          Activity

            People

            Assignee:
            kdonald Keith Donald
            Reporter:
            vardlokkur Michał Jaśtak
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: