Monday, November 1, 2010


 I had configured the OpenSessionInViewFilter as expected and yet I was still encountering this error.
After much debugging and code tracing in hibernate and in spring, it boiled down to the spring class

SessionFactoryUtils requiring the the sessionFactory instance be the same in the DAOs and in the filter.
After dumping out the identity of the session factories using System.identityHashCode() method, I discovered that they were in fact different instances hence the:

"no session or session closed" error message!

Why do I have multiple session factories?
It's because in the web.xml and the spring XML configuration it was read twice!

See the following link for more details

Once I reconfigured spring to only load each configuration file only once, the error message went away!

No comments:

Post a Comment