0 Replies Latest reply on Jun 28, 2010 8:15 AM by aimee

    HELP-15 min Idle Time - LazyInitException

    aimee

      Seam 2.2.0.GA, JBoss 4.2.3.GA


      The session timeout, conversation timeout, and SFSB timeout are set to 180 minutes.


      I have a product request form with a RichFaces tab. When the page is accessed, a nested conversation is begun using @Begin .  There is a conversation-scoped SFSB (ProductRequestManager) backing the page, and the SFSB holds a reference to a ProductRequest. ProductRequest has several collections, all marked FetchType.LAZY.  When the page sits idle for at least 15 minutes and I switch tabs, a LazyInitializationException is thrown trying to access any of the collections in the ProductRequest object. I am using a Seam-managed EntityManager.


      Debug information shows the conversation is still active, yet the Hibernate session has been closed. How can that happen? Am I missing a setting somewhere? How can I prevent the LIE? The end users frequently leave the application idle for over 15 minutes during the work day.


      components.xml:



      <!-- 10800000 milliseconds = 180 minutes -->
      <!--  web.xml session timeout is 180 minutes -->
      <core:manager concurrent-request-timeout="1000"
           conversation-timeout="10800000"           
           conversation-id-parameter="cid"
           parent-conversation-id-parameter="pid" />
      <!-- Persistence -->
      <persistence:entity-manager-factory
           name="entityManagerFactory" 
           persistence-unit-name="TsseJ" />
      <persistence:managed-persistence-context
           auto-create="true" 
           entity-manager-factory="#{entityManagerFactory}"
           name="entityManager" />



      Stack Trace:



      13:32:34,163 ERROR [LazyInitializationException] failed to lazily initialize a collection of role: com.att.tsse.bo.ProductRequest.productRequestItems, no session or session was closed
      org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.att.tsse.bo.ProductRequest.productRequestItems, no session or session was closed
           at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
           at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
           at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
           at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
           at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:272)
           at com.att.tsse.bo.ProductRequest.getOverallInitialCost(ProductRequest.java:191)