日期:2014-05-18  浏览次数:20816 次

session is closed 这个报错把我搞疯了,高手快来帮忙啊!
net.sf.hibernate.HibernateException:   Session   is   closed
at   net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3283)
at   com.kingstargroup.system.OnLineBean.updateOnLine(OnLineBean.java:197)
at   org.apache.jsp.webui.end_jsp._jspService(end_jsp.java:56)
at   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
at   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at   org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at   org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at   org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at   org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at   org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at   org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at   org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at   org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
at   org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at   org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at   java.lang.Thread.run(Thread.java:595)

------解决方案--------------------
你在程序中 关闭了session了
at com.kingstargroup.system.OnLineBean.updateOnLine(OnLineBean.java:197)
看你OnLineBean中updateOnLine()调用的session应该在之前被你关闭了。
------解决方案--------------------
updateOnLine()函数前肯定已经关闭session了
------解决方案--------------------
或许程序进行所用的session 你提前进行了关闭
------解决方案--------------------
在POJO.hbm.xml配制文件中,例如:
<class name= "Table " table= "TABLE " lazy= "false ">
.......
</class>

注意把lazy改成false,你这样再试试看~~~