当前位置: 代码迷 >> J2EE >> on org.hibernate.exception.GenericJDBCException: could not execute query
  详细解决方案

on org.hibernate.exception.GenericJDBCException: could not execute query

热度:86   发布时间:2016-04-22 02:20:17.0
使用proxool连接池几个小时之后总是会报错!
环境:tomcat6.0+proxool-0.9.01+hibernate3.1+mysql5.0
请大侠解决!!
proxool.xml:
XML code
<?xml version="1.0" encoding="UTF-8"?>  <something-else-entirely>      <proxool>          <alias>mysqlProxool</alias>         <driver-url>jdbc:mysql://127.0.0.1/shaiyaya</driver-url>        <driver-class>com.mysql.jdbc.Driver</driver-class>        <driver-properties>              <property name="user" value="root" />            <property name="password" value="banpeizhi" />          </driver-properties>                   <maximum-connection-count>100</maximum-connection-count>            <minimum-connection-count>10</minimum-connection-count>            <maximum-active-time>6000000</maximum-active-time>          <house-keeping-sleep-time>120000</house-keeping-sleep-time>          <maximum-new-connections>10</maximum-new-connections>            <prototype-count>5</prototype-count>            <test-before-use>true</test-before-use>          <house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>      </proxool>  </something-else-entirely> 


hibernate.cfg.xml:
XML code
<session-factory>        <property name="hibernate.proxool.pool_alias">mysqlProxool</property>        <property name="hibernate.proxool.xml">proxool.xml</property>        <property name="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</property>        <property name="hibernate.proxool.existing_pool">true</property>        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>        <property name="hibernate.cache.use_query_cache">true</property>                <!--是否将运行期生成的SQL输出到日志以供调试-->        <property name="show_sql">false</property>                 <!-- 事务管理类型 (显示配置)-->        <property name="hibernate.transaction.factory_class">            org.hibernate.transaction.JDBCTransactionFactory        </property>                <!-- 映射资源文件 -->        <mapping resource="com/shaiyaya/dao/Report.hbm.xml" />                ……


报错:
Java code
Struts Problem ReportStruts has detected an unhandled exception:Messages:    Couldn't perform the operation prepareStatement: You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs).FreeMarker template error!Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not execute queryThe problematic instruction:----------==> ${msg[0]} [on line 68, column 29 in org/apache/struts2/dispatcher/error.ftl]----------Java backtrace for programmers:----------freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not execute query    at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)    at freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:138)    at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111)    at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)    at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)    at freemarker.core.Expression.getStringValue(Expression.java:93)    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.MixedContent.accept(MixedContent.java:92)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.IfBlock.accept(IfBlock.java:82)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)    at freemarker.core.Environment.visit(Environment.java:415)    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.MixedContent.accept(MixedContent.java:92)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.IfBlock.accept(IfBlock.java:82)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.MixedContent.accept(MixedContent.java:92)    at freemarker.core.Environment.visit(Environment.java:208)    at freemarker.core.Environment.process(Environment.java:188)    at freemarker.template.Template.process(Template.java:237)    at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:703)    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at com.shaiyaya.filter.LoginFilter.doFilter(LoginFilter.java:34)    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:233)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)    at java.lang.Thread.run(Thread.java:619)Caused by: java.lang.NullPointerException    at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:85)    at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)    ... 44 more
  相关解决方案