-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Nonrecoverable Transaction (newbie quest)
PostPosted: Wed Dec 28, 2005 4:34 am 
Newbie

Joined: Tue Dec 27, 2005 11:57 am
Posts: 1
Hello,

I use hibernate extended Session pattern and everything goes ok until session is not invalidated first time both by application server or by direct calling invalidate();
If application server perform httpSession.invalidate() at the method doFilter from class HibernateThreadExtendedFilter on ‘finally’ section marked line throws exception:

Code:
finally {
                log.error("Cleanup after exception!");

                // Cleanup
                log.debug("Closing and unbinding Session from thread");
                sf.getCurrentSession().close(); // Unbind is automatic here

                log.debug("Removing Session from HttpSession");
                httpSession.setAttribute(HIBERNATE_SESSION_KEY, null); <<<<<<<<<<<<<<< removeAttribute: Can’t do it because session already invalidated!

            }

            // Let others handle it... maybe another interceptor for exceptions?
            throw new ServletException(ex);
        }

    }


After that I have a trouble with restoring transaction even if new session has been started. Here is my log. I’ve done httpSession.invalidate() (logout in my app) then I try to log in again.

Quote:
135032 ERROR company.name.app.util.HibernateThreadExtendedFilter : removeAttribute: Session already invalidated <<<< finally section after logout
450344 DEBUG company.name.app.util.HibernateThreadExtendedFilter : >>> New conversation <<< try to log in again.
450344 DEBUG company.name.app.util.HibernateThreadExtendedFilter : Starting a database transaction
450344 DEBUG company.name.app.util.ExtendedThreadLocalSessionContext : Opening a new Session
450344 DEBUG company.name.app.util.ExtendedThreadLocalSessionContext : Disabling automatic flushing of the Session
450407 DEBUG company.name.app.util.HibernateThreadExtendedFilter : Committing database transaction
450407 DEBUG company.name.app.util.HibernateThreadExtendedFilter : Unbinding Session from thread
450407 DEBUG company.name.app.util.HibernateThreadExtendedFilter : Storing Session in the HttpSession
450407 DEBUG company.name.app.util.HibernateThreadExtendedFilter : > Returning to user in conversation
468985 DEBUG company.name.app.util.HibernateThreadExtendedFilter : < Continuing conversation
468985 DEBUG company.name.app.util.HibernateThreadExtendedFilter : Starting a database transaction
org.hibernate.HibernateException: createCriteria is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:289)
at $Proxy0.createCriteria(Unknown Source)
at company.name.app.dao.hibernate.GenericDAOHibernate.findByCriteria(GenericDAOHibernate.java:106)
at company.name.app.dao.hibernate.GenericDAOHibernate.findAll(GenericDAOHibernate.java:77)


Could somebody tell me what might be the reason of such application behavior? Is it possible to make transaction restore with the session?

Thanks in advance,

Andrey


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.