This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Spring-Hibernate: LazyInitializationException

Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm using Spring and Hibernate in my Web application. When I try to access a hibernate object from my struts action class or my JSP page, I get an exception stating:

Uncaught exception thrown in one of the service methods of the servlet: action. Exception thrown : javax.servlet.ServletException: could not initialize proxy - the owning Session was closed

Does anyone know what I'm doing wrong and how to solve the problem.

Here's my code:


<!-- =================== Define Spring Bean Definition Files to be loaded ================== -->



<!-- =================== Spring Context Loader Servlet ================== -->

////JAVA CODE//////

BusinessServiceCbo businessServiceCbo = new
BusinessCbo businessCbo = new BusinessCbo();
businessCbo = businessDao.findById(businessId);

List serviceList = new ArrayList( businessCbo.getBusinessServices());


System.out.println("Service List: " + businessDetailDto.getServiceList()); //error occurs here!!!

///APPLiCATION Context.xml /////

<bean id="businessBSTarget" class="">
<property name="businessDao"><ref local="businessDao" /></property>
<bean id="businessBS" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<property name="target">
<ref local="businessBSTarget" />
<property name="interceptorNames">


<!-- ============================= Spring Plugin ================================== -->

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
value="/WEB-INF/presentationContext.xml classpath*:com/PBCoreApp/architecture/applicationContext.xml" />

WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!