You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yucca Nel <yu...@live.co.za> on 2010/05/17 20:17:38 UTC
help with hibernate (Iknow it's off topic)
but the following forums seem dead.
I am horrified by the following code causing a untime exception because I want to make sure hibernate session is closed but even though the session is null, it appears to be open still?
finally {
if(session!=null){
session.close();
}
}
/I don't want a memory leak but it appears that the following exception is thrown with the above code...
root cause
org.hibernate.SessionException: Session was already closed
org.hibernate.impl.SessionImpl.close(SessionImpl.java:302)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
$Proxy0.close(Unknown Source)
org.bar.jar.model.UserManagerBean.getAllEntities(UserManagerBean.java:120)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
org.apache.el.parser.AstValue.getValue(AstValue.java:123)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
javax.faces.component.UIData.getValue(UIData.java:614)
javax.faces.component.UIData.getDataModel(UIData.java:1145)
javax.faces.component.UIData.setRowIndex(UIData.java:451)
com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:77)
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
javax.faces.component.UIData.encodeBegin(UIData.java:983)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
RE: help with hibernate (Iknow it's off topic)
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Yucca Nel [mailto:yuccanel@live.co.za]
> Subject: help with hibernate (Iknow it's off topic)
>
> I am horrified by the following code causing a untime exception
Someone call Stephen Hawking so we can get details about "untime"...
> I want to make sure hibernate session is closed but even though the
> session is null, it appears to be open still?
What makes you think it's null? It looks like it's not null, but already closed.
The following might be better:
finally {
if (session != null && !session.isClosed()) {
session.close();
}
}
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org