In our application, we get this "org.hibernate.SessionException: Session is closed!" very frequently and it is not consistent, at some point we would get this exception, and at some point we dont get this, Well i googled about this exception and also searched in Javaranch site, but didnt help me. if some body knows what is causing the issue please advice.
The actual exception:
sessionFactory object created in the applicationcontext.xml file is injected to all the DAO classes and we get the session object using the following statement in the DAO classes:
The exception is thrown at "Transaction tx = session.beginTransaction();" line, since the session is already closed, when we try to begin the transaction, but it is very clear that we are getting the new session object, but some how for some reason it is automatically getting closed, not sure why, main problem is this exception is not consistent, for a single use case it throws this exception at some time and it doesn't at other times, I am not even sure like how to reproduce this. I learnt that a session object has to be created for a request level, some how it has not been followed in ours. If some one have any thoughts to get rid of this exception please share