Announcement Announcement Module
Collapse
No announcement yet.
SnapshotCreationException with <aop:scoped-proxy /> Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SnapshotCreationException with <aop:scoped-proxy />

    Hi there,

    I got a problem with the serialization of an object. Using Spring-Webflow I've got the following entry in a view-state:

    Code:
        	<on-entry>
        		<evaluate expression="verfuegbareKriterien.getKriterien()" result="viewScope.verfuegbareAnzeigekriterien" />
        	</on-entry>
    Accessing this View-State i get the following exception:
    Code:
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is 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.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    Now some important piece of configuration an code for you:

    The definition of verfuegbareKriterien:
    Code:
           <bean name="verfuegbareKriterien" scope="session" class="de.xyz.bla.kriterien.VerfuegbareKriterien">
            <aop:scoped-proxy/>
           	<property name="kriterien">
           		<list>
           			<ref bean="bundeslandKriterium" />
           		</list>
           	</property>
           </bean>
    The definition of bundeslandKriterium:
    Code:
           <bean name="bundeslandKriterium" scope="session" class="de.xyz.bla.kriterien.BundeslandKriterium">
           	<aop:scoped-proxy />       	
           	<property name="bezeichnung" value="BUNDESLAND"/>	
           	<property name="id" value="1" />
           </bean>
    The class-definition of verfuegbareKriterien
    Code:
    public class VerfuegbareKriterien implements Serializable {
    
    	private ArrayList<Kriterium> kriterien;
    
    	public ArrayList<Kriterium> getKriterien() {
    		return kriterien;
    	}
    
    	public void setKriterien(ArrayList<Kriterium> kriterien) {
    		this.kriterien = kriterien;
    	}
    }
    The class-definition of bundeslandKriterium:
    Code:
    public class BundeslandKriterium extends Kriterium implements Serializable {
    	private ArrayList<Bundesland> bundeslaender;
    
    	public ArrayList<Bundesland> getBundeslaender() {
    		return bundeslaender;
    	}
    
    	public void setBundeslaender(ArrayList<Bundesland> bundeslaender) {
    		this.bundeslaender = bundeslaender;
    	}
    }
    And the class-definition of the class "Kriterium" which is extended by the class BundeslandKriterium
    Code:
    public abstract class Kriterium implements Serializable {
    	private String bezeichnung;
    	private int id;
    
    	public int getId() {
    		return id;
    	}
    
    	public void setId(int id) {
    		this.id = id;
    	}
    
    	public String getBezeichnung() {
    		return bezeichnung;
    	}
    
    	public void setBezeichnung(String bezeichnung) {
    		this.bezeichnung = bezeichnung;
    	}
    }
    If I don't scope-proxy the bean "bundeslandKriterium" I do not get this Exception and everything works just fine. But I need this bean to be in session-scope.

    Any suggestions?

    Thanks in advance,
    Matschbirne

  • #2
    After hours of googling I found out that those proxied Beans are not Serializable in general. That means they can not be stored in viewScope/flowScope/etc.. I "solved" this problem by not saving the beans themself in the viewScope but a map of the values I need.

    Greets,
    Matschbirne

    Comment


    • #3
      http://jira.springframework.org/browse/SWF-749

      Comment

      Working...
      X