-->
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: Exception :could not initialize proxy-no Session
PostPosted: Wed Apr 02, 2008 5:30 pm 
Beginner
Beginner

Joined: Mon Mar 17, 2008 11:25 am
Posts: 42
hi,
Iused to run JBoss and included Hibernate 3.2.0CR2 ourselves.
Unfortunately, I'm getting LazyInitializationException
Error:

Code:
23:18:44,874 ERROR [LazyInitializationException] could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:166)
   at model.Category_$$_javassist_1.getName(Category_$$_javassist_1.java)
   at controller.ProductController.<init>(ProductController.java:62)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryImpl.java:277)
   at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:527)
   at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:82)
   at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
   at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
   at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
   at org.apache.el.parser.AstValue.getValue(AstValue.java:86)
   at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
   at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
   at javax.faces.component.UIData.getValue(UIData.java:582)
   at javax.faces.component.UIData.getDataModel(UIData.java:1063)
   at javax.faces.component.UIData.setRowIndex(UIData.java:417)
   at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:85)
   at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
   at javax.faces.component.UIData.encodeBegin(UIData.java:879)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:269)
   at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:117)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
   at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
   at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
   at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Unknown Source)
23:18:44,907 FATAL [application] JSF1001: Managedbean prodContr could not be created.
23:18:44,907 WARN  [lifecycle] executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@22f376) threw exception
javax.faces.FacesException: javax.faces.FacesException: Cant instantiate class: controller.ProductController.. could not initialize proxy - no Session
   at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:537)
   at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:82)
   at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
   at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
   at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
   at org.apache.el.parser.AstValue.getValue(AstValue.java:86)
   at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
   at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
   at javax.faces.component.UIData.getValue(UIData.java:582)
   at javax.faces.component.UIData.getDataModel(UIData.java:1063)
   at javax.faces.component.UIData.setRowIndex(UIData.java:417)
   at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:85)
   at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
   at javax.faces.component.UIData.encodeBegin(UIData.java:879)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:269)
   at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:117)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
   at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
   at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
   at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.FacesException: Cant instantiate class: controller.ProductController.. could not initialize proxy - no Session
   at com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryImpl.java:282)
   at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:527)
   ... 45 more
Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:166)
   at model.Category_$$_javassist_1.getName(Category_$$_javassist_1.java)
   at controller.ProductController.<init>(ProductController.java:62)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryImpl.java:277)
   ... 46 more
23:18:44,908 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:166)
   at model.Category_$$_javassist_1.getName(Category_$$_javassist_1.java)
   at controller.ProductController.<init>(ProductController.java:62)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryImpl.java:277)
   at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:527)
   at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:82)
   at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
   at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
   at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
   at org.apache.el.parser.AstValue.getValue(AstValue.java:86)
   at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
   at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
   at javax.faces.component.UIData.getValue(UIData.java:582)
   at javax.faces.component.UIData.getDataModel(UIData.java:1063)
   at javax.faces.component.UIData.setRowIndex(UIData.java:417)
   at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:85)
   at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
   at javax.faces.component.UIData.encodeBegin(UIData.java:879)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:269)
   at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:117)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
   at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
   at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
   at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Unknown Source)


please help


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 03, 2008 1:38 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi


this may occurs at the point you access a collection of a persistance object when session has closed. keep session open until you finished your job.

send your java codes to more details.


Amila
(Don't forget to rate if helps)


Top
 Profile  
 
 Post subject: org.hibernate.LazyInitializationException: could not initia
PostPosted: Fri Oct 10, 2008 12:12 am 
Newbie

Joined: Thu Oct 09, 2008 10:27 pm
Posts: 3
I got thesame problem, could you show me the way

public void setEnterSchoolCurrentContestant(Contestant1 enterSchoolCurrentContestant) {
this.enterSchoolCurrentContestant = enterSchoolCurrentContestant;
Hibernate.initialize(enterSchoolCurrentContestant.getCandidatetimes());
this.enterschoolCurrentCandidatetimes = enterSchoolCurrentContestant.getCandidatetimes();
Hibernate.initialize(this.enterschoolCurrentCandidatetimes.getAcademicyear());
this.enterschoolCurrentAcaYear =this.enterschoolCurrentCandidatetimes.getAcademicyear();
Hibernate.initialize(this.enterschoolCurrentCandidatetimes.getSemester());
this.enterschoolCurrentSemester = this.enterschoolCurrentCandidatetimes.getSemester();
}

_________________
Pham Ngoc Bao Cuong
http://www.s3s.com.vn


Top
 Profile  
 
 Post subject: Re: Exception :could not initialize proxy-no Session
PostPosted: Sat Jun 27, 2009 5:24 am 
Newbie

Joined: Sat Jun 27, 2009 5:14 am
Posts: 1
set lazy = "false" in hibernate mapping file.

for example check herehttp://java-masters.blogspot.com/


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.