1、JDBC连接数据库时卡在如下位置
hikari.HikariDataSource |- HikariPool-1 - Starting...
2、过一会JDBC连接超时,报如下错误
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
3、但是手动可以连接数据库,本地调试JAVA代码也是可以连接数据库,使用k8s部署后就会出现此问题
(1)在JDBC的连接的URL后面加上如下内容
&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10
(2)然后在pom.xml文件中增加配置如下内容
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
(3)重新部署后,解决