页面调用方法时候出现问题:No operations allowed after connection closed
查看tomcat日志文件中:
2018-04-13 14:57:11.147 DEBUG 1506 --- [bio-8080-exec-2] o.s.b.w.f.OrderedRequestContextFilter : Bound request context to thread: org.apache.catalina.connector.RequestFacade@83332d8
2018-04-13 14:57:11.149 DEBUG 1506 --- [bio-8080-exec-2] o.s.b.w.f.OrderedRequestContextFilter : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@83332d8
2018-04-13 14:57:11.152 ERROR 1506 --- [bio-8080-exec-2] o.s.boot.web.support.ErrorPageFilter : Forwarding to error page from request [/admin/1] due to exception [
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
### The error may exist in file [/usr/local/tomcat/webapps/domain_admin/WEB-INF/classes/mapper/AdminMapping.xml]
### The error may involve domain.dao.impl.AdminDao.getOne
### The error occurred while executing a query
### SQL: SELECT * from admin where userid = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
; SQL []; No operations allowed after connection closed.; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.]
最终重新启动了tomcat,发现可以使用了,网上查查发现多数都说的是它好像是空闲多长时间之后就关闭了!再连接就会报错!由于连接的方法是静态的,所以没有办法在重新连接。