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

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

    Hello.

    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
    java.io.ObjectInputStream$BlockDataInputStream.set BlockDataMode(ObjectInputStream.java:2376)
    java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1360)
    java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1946)
    java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1870)
    java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1752)
    java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1328)
    java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:350)
    org.springframework.webflow.core.collection.LocalA ttributeMap.readObject(LocalAttributeMap.java:342)
    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:597)
    java.io.ObjectStreamClass.invokeReadObject(ObjectS treamClass.java:974)
    java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1848)
    java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1752)
    java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1328)
    java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:350)
    org.springframework.webflow.engine.impl.FlowSessio nImpl.readExternal(FlowSessionImpl.java:147)
    java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:1791)
    java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1750)
    java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1328)
    java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:350)
    java.util.LinkedList.readObject(LinkedList.java:96 4)
    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:597)
    java.io.ObjectStreamClass.invokeReadObject(ObjectS treamClass.java:974)
    java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1848)
    java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1752)
    java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1328)
    java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:350)
    org.springframework.webflow.engine.impl.FlowExecut ionImpl.readExternal(FlowExecutionImpl.java:305)
    java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:1791)
    java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1750)
    java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1328)
    java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:350)
    org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshot.deserializ e(SerializedFlowExecutionSnapshot.java:194)
    org.springframework.webflow.execution.repository.s napshot.SerializedFlowExecutionSnapshot.unmarshal( SerializedFlowExecutionSnapshot.java:99)
    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:112)
    org.springframework.webflow.executor.FlowExecutorI mpl.resumeExecution(FlowExecutorImpl.java:168)
    org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(FlowHandlerAdapter.java:183)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:788)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:717)
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:560)
    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(ServletWrapper.java:72)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 343)
    org.springframework.security.web.access.intercept. FilterSecurityInterceptor.invoke(FilterSecurityInt erceptor.java:109)
    org.springframework.security.web.access.intercept. FilterSecurityInterceptor.doFilter(FilterSecurityI nterceptor.java:83)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.access.ExceptionT ranslationFilter.doFilter(ExceptionTranslationFilt er.java:97)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.session.SessionMa nagementFilter.doFilter(SessionManagementFilter.ja va:100)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.authentication.An onymousAuthenticationFilter.doFilter(AnonymousAuth enticationFilter.java:78)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.servletapi.Securi tyContextHolderAwareRequestFilter.doFilter(Securit yContextHolderAwareRequestFilter.java:54)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.savedrequest.Requ estCacheAwareFilter.doFilter(RequestCacheAwareFilt er.java:35)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.authentication.http://www.BasicAuthenticationFilter...ilter.java:177)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.authentication.Ab stractAuthenticationProcessingFilter.doFilter(Abst ractAuthenticationProcessingFilter.java:188)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.authentication.lo gout.LogoutFilter.doFilter(LogoutFilter.java:105)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:79)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 355)
    org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:149)
    org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:237)
    org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:167)
    org.springframework.web.filter.HiddenHttpMethodFil ter.doFilterInternal(HiddenHttpMethodFilter.java:7 7)
    org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)
    com.gemstone.gemfire.modules.session.filter.Sessio nCachingFilter.doFilter(SessionCachingFilter.java: 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 '[FlowExecutionImpl@e31ec5 flow = 'hotels/booking', flowSessions = list[[FlowSessionImpl@f94934 flow = 'hotels/booking', state = 'reviewBooking', scope = map['persistenceContext' -> org.hibernate.ejb.EntityManagerImpl@3525a2, '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 http://forum.springsource.org/showthread.php?t=68383 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.

    TIA.

    --Jens

  • #2
    Solved

    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.

    --Jens

    Comment


    • #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.

      Thanks!

      Trygve.

      Comment

      Working...
      X