应用数据库从MYSQL迁移到XDB
迁移过程中,有一个web后端应用修改数据库配置之后报错
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-10-09 17:12:13,170 ERROR [main] o.s.boot.SpringApplication [SpringApplication.java : 842] Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'RRExceptionHandler': Unsatisfied dependency expressed through field 'XXXXXXX'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXXXXXX': Invocation of init method failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### The error may exist in xxxxxxxxxxxxxxx.java (best guess)
### The error may involve xxxxxxxxxxxxx.selectList
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
检索此问题,大多指向数据库连接配置文件或者数据库服务端连接配置,但是始终无法解决问题
检查数据库网络连接正常,mysql驱动版本正常,最终发现问题为加密数据库用户名密码所使用的加密组件影响导致,pom配置如下
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
当不使用此插件后,应用启动正常。至于底层机制上的原因有待进一步研究