hibernate中的连接代理错误

时间:2012-11-02 12:43:20

标签: java hibernate

当我们通过休眠获得连接时,我们在使用多个连接时出现错误连接代理错误

错误信息如下面的陈述

SEVERE: Servlet.service() for servlet action threw exception org.hibernate.HibernateException: connnection proxy not usable after transaction completion at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:66) at $Proxy0.prepareStatement(Unknown Source) at com.indiamoney.api.advisor.dashboard.dao.impl.AdvisorDashboardDAOImpl.getCustemerRequestsCount(AdvisorDashboardDAOImpl.java:571) at com.indiamoney.api.advisor.dashboard.bo.AdvisorDashboardBO.getCustemerRequestsCount(AdvisorDashboardBO.java:226) at com.indiamoney.advisor.dashboard.action.AdvisorDashboardAction.dashboardDetails(AdvisorDashboardAction.java:307) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) 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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) Nov 1, 2012 9:18:37 PM org.apache.tomcat.util.http.Parameters processParameters WARNING: Parameters: Invalid chunk ignored. Nov 1, 2012 9:18:37 PM org.apache.tomcat.util.http.Parameters processParameters WARNING: Parameters: Invalid chunk ignored.

2 个答案:

答案 0 :(得分:2)

我在使用hibernate 3.2.7 / Spring 3.0.5和ope-session-in-view过滤器的一个更棘手的用例中遇到了异常。大概是因为分离的实体作为参数传递给新线程并在单独的事务中更新。

答案 1 :(得分:0)

我们的系统在几天前遇到此异常。我跟踪了BorrowedConnectionProxy.java,发现这个问题是由hibernate使用之前关闭连接引起的:

我们使用Session.connection()来获取会话中寄生的连接并以manaually方式关闭它。在这种情况下,异常将在调用Session上与db相关的任何方法时被抛弃。

因此,请检查并确保hibernate / session获取有效连接(处于正确状态)。希望这对你的情况有效。