aspose file tools*
The moose likes Other Application Frameworks and the fly likes OpenSessionInViewFilter problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "OpenSessionInViewFilter problem" Watch "OpenSessionInViewFilter problem" New topic
Author

OpenSessionInViewFilter problem

Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
Hi all,

I have been using the OpenSessionInViewFilter has some time in projets. But in this project I catch this problem:

(I am using Hibernate, Spring MVC, Acegi and Sitemesh)




Has you can see, the OpenSessionInViewFilter is called in stack!


and my web.xml:




Thank-you
[ September 11, 2007: Message edited by: Luciano A. Pozzo ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Not sure that the problem comes from the filter. Do you have a "cadastro.jsp" ? There seems to be a problem in a JSTL forEach loop in that file.


[My Blog]
All roads lead to JavaRanch
Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
Hi Christophe,

Thank-you for the reply. So, I made some tests for detect where is the problem. And I believe that it is something wrong in my transaction control, in the business layer. For some reason it is closing the hibernate session.

How I had this conclusion, because I tried to access from the controller directly to DAO, and worked fine (did not closed the hibernate session and the lazy worked). And when I use through the business layer, I catch the org.hibernate.LazyInitializationException.

So, the question is, when the transaction control commit a transaction, I should lost the hibernate session?


Thank-you
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Sorry, I don't about this kind of problem. I've found a document on Hibernate which tells that sessions obtain with getCurrentSession will be flushed and closed when the transaction is committed. Please have a look at this page.
 
 
subject: OpenSessionInViewFilter problem