The website runs one night, comes to work in the morning, found the error:
# # # Error querying database. Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:No operations allowed after connection Closed.
Checked online, because the default configuration is used, idle for more than 8 hours, automatically disconnect the connection
I used the default connection pool for MyBatis, so I configured the matching. DataSource properties, refer to MyBatis official documentation
<EnvironmentID= "Env_stg"> <TransactionManagertype= "JDBC" /> <DataSourcetype= "Pooled"> < Propertyname= "Driver"value= "${driver}" /> < Propertyname= "url"value= "${url_stg}" /> < Propertyname= "username"value= "${username}" /> < Propertyname= "Password"value= "${password}" /> < Propertyname= "Poolmaximumactiveconnections"value= " the"/> < Propertyname= "Poolmaximumidleconnections"value= "5"/> <!--mysqlnontransientconnectionexception:no operations allowed after connection closed - < Propertyname= "Poolpingquery"value= "Select 1"/> < Propertyname= "poolpingenabled"value= "true"/> <!--one-hour check for idle connections - < Propertyname= "Poolpingconnectionsnotusedfor"value= "3600000"/> </DataSource> </Environment>
Reference: http://fengbin2005.iteye.com/blog/1906488
A great article: "In-depth understanding of mybatis principles" mybatis data sources and connection pooling
MyBatis Connection MySQL Report exception: No operations allowed after connection closed. Connection was implicitly closed