I ran an experiment to test this out. I am using the Spring Webflow/JSF integration for SWF 2.0/JSF RI 1.2 and a Hibernate persistence context. Here is what i did.
Here is my setup.
1. Two tomcat instances with session clustering turned on.
2. Apache webserver configured to load balance the two tomcat instances via mod_jk.
3. A webflow inside of the two said tomcat instances that utilizes a Spring Webflow persistence context.
Steps performed.
1. Bootup both tomcat instances.
2. Bootup the apache webserver.
3. Attempt to access the webflow through the apache webserver.
4. Spring Security associated with the webflow re-routes to the login page.
5. Login providing proper credentials.
6. Navigate to the webflow. No attached objects are read.
7. Bring down the tomcat instance that has been serving the traffic until now.
8. Click a link to navigate into the flow. (Apache webserver re-routes to the single running instance).
9. An error happens in webflow when reading serialized data.
Since there were no persistent objects read and stored in flow, conversation, view, or any other scope i temporarily commented out the persistence-context. And repeated the above steps. The difference is this time step 9 worked and i was routed to the view within the flow the link was intended to route me to. If this is a boundary case not intended to be supported, fine, but i'd think it shouldn't blow up like that. Can anyone provide clarification on what behavior should be displayed ?
The above mentioned exception ........
java.lang.IllegalStateException: unread block data
java.io.ObjectInputStream$BlockDataInputStream.set BlockDataMode(ObjectInputStream.java:2324)
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1336)
java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1908)
java.io.ObjectInputStream.defaultReadObject(Object InputStream.java:479)
org.springframework.webflow.core.collection.LocalA ttributeMap.readObject(LocalAttributeMap.java:331)
sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
java.io.ObjectStreamClass.invokeReadObject(ObjectS treamClass.java:946)
java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1809)
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1719)
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:348)
org.springframework.webflow.engine.impl.FlowSessio nImpl.readExternal(FlowSessionImpl.java:147)
java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:1755)
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1717)
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:348)
java.util.LinkedList.readObject(LinkedList.java:77 6)
sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
java.io.ObjectStreamClass.invokeReadObject(ObjectS treamClass.java:946)
java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1809)
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1719)
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:348)
org.springframework.webflow.engine.impl.FlowExecut ionImpl.readExternal(FlowExecutionImpl.java:513)
java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:1755)
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1717)
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:348)
org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshot.deserializ e(SerializedFlowExecutionSnapshot.java:193)
org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshot.unmarshal( SerializedFlowExecutionSnapshot.java:98)
org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshotFactory.res toreExecution(SerializedFlowExecutionSnapshotFacto ry.java:80)
org.springframework.webflow.execution.repository.s napshot.AbstractSnapshottingFlowExecutionRepositor y.restoreFlowExecution(AbstractSnapshottingFlowExe cutionRepository.java:89)
org.springframework.webflow.execution.repository.i mpl.DefaultFlowExecutionRepository.getFlowExecutio n(DefaultFlowExecutionRepository.java:104)
org.springframework.webflow.executor.FlowExecutorI mpl.resumeExecution(FlowExecutorImpl.java:162)
org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(FlowHandlerAdapter.java:173)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:875)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:807)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
org.apache.myfaces.webapp.filter.ExtensionsFilter. doFilter(ExtensionsFilter.java:301)
filters.RequestDumperFilter.doFilter(RequestDumper Filter.java:167)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :378)
org.springframework.security.intercept.web.FilterS ecurityInterceptor.invoke(FilterSecurityIntercepto r.java:109)
org.springframework.security.intercept.web.FilterS ecurityInterceptor.doFilter(FilterSecurityIntercep tor.java:83)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.ui.SessionFixationPro tectionFilter.doFilterHttp(SessionFixationProtecti onFilter.java:67)
org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.ui.ExceptionTranslati onFilter.doFilterHttp(ExceptionTranslationFilter.j ava:101)
org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.providers.anonymous.A nonymousProcessingFilter.doFilterHttp(AnonymousPro cessingFilter.java:105)
org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.ui.rememberme.Remembe rMeProcessingFilter.doFilterHttp(RememberMeProcess ingFilter.java:116)
org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.wrapper.SecurityConte xtHolderAwareRequestFilter.doFilterHttp(SecurityCo ntextHolderAwareRequestFilter.java:91)
org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.ui.basicauth.BasicPro cessingFilter.doFilterHttp(BasicProcessingFilter.j ava:174)
org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
org.springframework.security.ui.AbstractProcessing Filter.doFilterHttp(AbstractProcessingFilter.java: 277)
org.springframework.security.ui.SpringSecurityFilt er.doFilter
The webflow configuration .......
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<secured attributes="ROLE_USER"/>
<persistence-context />
<var name="jsfDocumentBackingBean" class="com.openfunctionality.teammanager.component s.documentmanager.ResourceDocumentManagerBackingBe an"/>
<on-start>
<evaluate expression="jsfDocumentBackingBean.setRootCategori es(documentManager.getRootCategories())"/>
</on-start>
<view-state id="displayDocuments" view="views/displayDocuments.jsp">
<transition on="toggle" to="displayDocuments">
</transition>
<transition on="subcategoryAdded" to="displayDocuments">
</transition>
<transition on="rootCategoryAdded" to="displayDocuments">
</transition>
<transition on="resourceAdded" to="displayDocuments">
</transition>
</view-state>
</flow>
Joe Rust
Principal Consultant
Cardinal Solutions Inc.