-->
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.  [ 4 posts ] 
Author Message
 Post subject: hibernate.LazyInitializationException
PostPosted: Thu Oct 12, 2006 8:36 am 
Newbie

Joined: Thu Oct 12, 2006 7:17 am
Posts: 1
Hi,

My application currently running in Tomcat5.0 & SAP Web AS 6.40, but
the same application is not working JBOSS.


Architecture


JSP, Sturts, Spring, Hibernate

Db: MS SQL Sever 2000.

In hbm.xml file, Many-to-one relationship exist , while displaying data in JSP Page , it shows the following error.


Quote:
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed.


Can you suggest some thing about this. I would appreciate your help.

Wbr,
KK


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 12, 2006 9:59 am 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
You provided little information, some guesses below.

Can you post more of the stack trace?

What version of JBoss are you using and how is hibernate configured?
Look in the jboss server log and validate that the proper version of hibernate is used, maybe your jboss installation provided you with a second jar.

Check to see if there are other errors in the server.log

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 12, 2006 10:44 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
It appears (judging from the little information you provided) that you have closed the Hibernate session (or it was closed by Springs "lovely" HibernateTemplate) before you pass your POJOs to the JSP which tries to access a collection which was mapped as lazy and has not been loaded.

Please have a look at the Open Session in View Pattern described here:
http://www.hibernate.org/43.html

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 13, 2006 4:17 am 
Beginner
Beginner

Joined: Fri Oct 28, 2005 7:11 am
Posts: 20
If it EJB, you didn't properly start/finish transaction.
If you have any lazy properties, and you give back the Hibernate POJO to JSP and try to read this property, such expection is thrown as well.


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

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.