背景
生产环境都是部署在云服务器上,数据存储在云数据库中。默认配置可能和测试环境不一致。所以在没有提前了解其默认配置的话,作相应的修改,可能就遇到一些坑。这里主要这次架构升级所遇到的坑。
进入主题
- 数据库连接问题
### Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 82,940,457 milliseconds ago. The last packet sent successfully to the server was 82,940,457 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!--数据源配置 使用mysql数据库 -->
<environments default="aaa">
<environment id="aaa">
<transactionManager type