[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4006) Setting transaction.auto_close_session=true creates "Session is closed" warnings

Luc DEW (JIRA) jira-events at lists.jboss.org
Tue Mar 10 21:27:22 EDT 2009


Setting transaction.auto_close_session=true creates "Session is closed" warnings
--------------------------------------------------------------------------------

                 Key: JBSEAM-4006
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4006
             Project: Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.1.0.SP1
         Environment: Seam 2.1.0.SP1
Spring 2.5.5
Seam Managed Persistence Context enabled
JTA transaction Manager declared in Spring used.
Persistence unit property :"hibernate.transaction.auto_close_session=true" set to true
            Reporter: Luc DEW


Setting the hibernate.transaction.auto_close_session property to true cause "Session is closed!;" warnings in Seam with Seam Managed Persistence Context.

Because for instance, in the SeamPhaseListener's afterServletPhase(PhaseEvent event) the following code is executed:

handleTransactionsAfterPhase(event);
             if ( event.getPhaseId() == RENDER_RESPONSE )
      {
         afterRenderResponse(facesContext);
      }
      else if ( facesContext.getResponseComplete() )
      {
         afterResponseComplete(facesContext);
      }

If the current JSF phase is "after RENDER_RESPONSE" transaction is terminated (commited or rollbacked) by the handleTransactionsAfterPhaseMethod(event) method. If auto_close_session mode is set to true, the session is closed. But the afterRenderResponse(facesContext) is then executed. This method tries to change session's flush mode. Therefore, a "session is already closed" warning appears !

It should be documented that setting this parameter to true can cause this kind of errors in Seam. But not setting this parameter to true can cause Hibernate sessions leakage if the persistence context not handled by Seam. Also, i am not sure that in any Seam use cases, the managed persistence context is closed properly. Some examples a method annotated @Observer("org.jboss.seam.postInitialization") with or @Async... 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list