在一定时间内不访问项目,再次访问就会出现一下异常,等待一会儿重新发送请求即可正常访问。本人猜测是数据源连接问题,长时间不访问数据源连接失效了,然后第一次访问就会出现这个问题,然后等待数据源重新连接成功,就可以访问了。这是我猜测的原因,也不敢确定是不是这个原因。
有知道怎么解决的没?
2019-12-11 16:56:37 [ http-nio-8080-exec-1:417362 ] - [ DEBUG ] close statement error
java.sql.SQLRecoverableException: 关闭的连接
at oracle.jdbc.driver.PhysicalConnection.needLine(PhysicalConnection.java:5416)
at oracle.jdbc.driver.OracleStatement.closeOrCache(OracleStatement.java:1585)
at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1570)
at oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:94)
at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:96)
at com.alibaba.druid.pool.vendor.OracleValidConnectionChecker.isValidConnection(OracleValidConnectionChecker.java:88)
at com.alibaba.druid.pool.DruidAbstractDataSource.testConnectionInternal(DruidAbstractDataSource.java:1335)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1099)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1066)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1056)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:104)
at com.jfinal.plugin.activerecord.Config.getConnection(Config.java:203)
at com.jfinal.plugin.activerecord.Model.find(Model.java:687)
at com.jfinal.plugin.activerecord.Model.find(Model.java:703)
at com.zrhis.system.model.XtglSectionHospital.queryOneSection(XtglSectionHospital.java:104)
at com.zrhis.systrm.service.RegistryListService.queryOneSection(RegistryListService.java:84)
at com.zrhis.system.controller.RegistryListController.statisticsManager(RegistryListController.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.jfinal.aop.Invocation.invoke(Invocation.java:83)
at com.zrhis.system.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:24)
at com.jfinal.aop.Invocation.invoke(Invocation.java:77)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:82)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
2019-12-11 16:56:37 [ http-nio-8080-exec-1:417368 ] - [ DEBUG ] skip not validate connection.
这是配置的DruidPlugin,其他相关属性并没有设置。
你为 DruidPlugin 加点配置试试, 看看这个类的源码,其中有一个 setter 方法可以配置 druid 定期向服务端发送请求,以便保持连接