Announcement Announcement Module
No announcement yet.
Clustering webflow booking app results in java.lang.IllegalStateException Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clustering webflow booking app results in java.lang.IllegalStateException


    I'm attempting to cluster the Webflow booking-mvc sample (based on Webflow 2.2.1.RELASE) on tcServer (Tomcat 6.0.29). For session replication I've tried to use the Gemfire HTTP session replication module as well as a custom session replication approach implemented via servlet filters. Although I'm quite familiar with Spring, this is my first exposure to Webflow as well as some of the underlying technologies such as JPA.

    I'm testing the app by navigating into a flow (booking a hotel in this case). Once I hit the booking page, I shut one of my TC instances down and attempt to continue the booking process at which point I hit the following exception:

    java.lang.IllegalStateException: unread block data$BlockDataInputStream.set BlockDataMode(
    org.springframework.webflow.core.collection.LocalA ttributeMap.readObject(
    sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    org.springframework.webflow.engine.impl.FlowSessio nImpl.readExternal(
    java.util.LinkedList.readObject( 4)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    org.springframework.webflow.engine.impl.FlowExecut ionImpl.readExternal(
    org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshot.deserializ e(
    org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshot.unmarshal(
    org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshotFactory.res toreExecution(SerializedFlowExecutionSnapshotFacto
    org.springframework.webflow.execution.repository.s napshot.AbstractSnapshottingFlowExecutionRepositor y.restoreFlowExecution(AbstractSnapshottingFlowExe
    org.springframework.webflow.execution.repository.i mpl.DefaultFlowExecutionRepository.getFlowExecutio n(
    org.springframework.webflow.executor.FlowExecutorI mpl.resumeExecution(
    org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(
    org.springframework.web.servlet.DispatcherServlet. doDispatch(
    org.springframework.web.servlet.DispatcherServlet. doService(
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
    org.springframework.web.servlet.FrameworkServlet.d oPost(
    javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
    com.gemstone.gemfire.modules.session.filter.Servle tWrapper.service($ VirtualFilterChain.doFilter( 343) FilterSecurityInterceptor.invoke(FilterSecurityInt FilterSecurityInterceptor.doFilter(FilterSecurityI$ VirtualFilterChain.doFilter( 355) ranslationFilter.doFilter(ExceptionTranslationFilt$ VirtualFilterChain.doFilter( 355) nagementFilter.doFilter(SessionManagementFilter.ja va:100)$ VirtualFilterChain.doFilter( 355) onymousAuthenticationFilter.doFilter(AnonymousAuth$ VirtualFilterChain.doFilter( 355) tyContextHolderAwareRequestFilter.doFilter(Securit$ VirtualFilterChain.doFilter( 355) estCacheAwareFilter.doFilter(RequestCacheAwareFilt$ VirtualFilterChain.doFilter( 355)$ VirtualFilterChain.doFilter( 355) stractAuthenticationProcessingFilter.doFilter(Abst$ VirtualFilterChain.doFilter( 355) gout.LogoutFilter.doFilter($ VirtualFilterChain.doFilter( 355) ontextPersistenceFilter.doFilter(SecurityContextPe$ VirtualFilterChain.doFilter( 355) doFilter(
    org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(
    org.springframework.web.filter.DelegatingFilterPro xy.doFilter(
    org.springframework.web.filter.HiddenHttpMethodFil ter.doFilterInternal( 7)
    org.springframework.web.filter.OncePerRequestFilte r.doFilter(
    com.gemstone.gemfire.modules.session.filter.Sessio nCachingFilter.doFilter( 434)

    I've done a fair bit of digging and think it's something inside the flow session which isn't getting deserialized correctly. My TC logs shows this line:

    DEBUG: org.springframework.webflow.execution.repository.i mpl.DefaultFlowExecutionRepository - Putting flow execution '[[email protected] flow = 'hotels/booking', flowSessions = list[[[email protected] flow = 'hotels/booking', state = 'reviewBooking', scope = map['persistenceContext' -> [email protected], 'booking' -> Booking(User(erwin),Hotel(Westin Diplomat,3555 S. Ocean Drive,Hollywood,33019)), 'hotelId' -> '1', 'viewScope' -> map[[empty]]]]]]' into repository

    I've started looking into the org.hibernate.ejb.EntityManagerImpl class to see if I can find anything which might not be de-serializing properly but have not had any luck so far.

    I've also tried some webflow setting such as max-execution-snapshots. Setting this to '1' results in the same exception. Setting it to '0' results in a ClassNotFoundException (class 'B' IIRC). Sorry, don't have a trace for that but I can create one if someone is interested.

    I've seen some other threads on this - particularly which has a suggested fix regarding hibernate sessions. Unfortunately I don't know how to configure this, or even if it's still relevant for Webflow 2.2.1.

    So any suggestions would be greatly appreciated. Also any confirmations of anyone using this booking sample, successfully, in a clustered environment.

    I'm going to try a different JPA provider to see if that helps.



  • #2

    After not having any joy getting Toplink to work, I configured OpenJPA which also threw exceptions. Finally, I went back to Hibernate and tried using a later version of Hibernate than what comes bundled with the booking sample app - specifically 3.5.1-Final. This time I started getting some meaningful errors. Ultimately, the solution was dead-simple. As the previously mentioned thread had alluded to, I needed name my session factory. I simply added the following to my persistence.xml and everything worked as advertised:

    <property name="hibernate.session_factory_name" value="session_factory"/>

    Now, during a flow, I can bring clustered server instances up or down without losing any data.



    • #3
      Hi, I'm having a very similar problem but with grails webflow, do you have an idea of how to configure this in grails? I don't have a persistence.xml file to append this.