具体报错内容如下:
java.lang.IllegalArgumentException: String length must be a multiple of four.
at com.alibaba.druid.util.Base64.base64ToByteArray(Base64.java:128) ~[druid-0.2.8.jar:0.2.8]
at com.alibaba.druid.util.Base64.base64ToByteArray(Base64.java:110) ~[druid-0.2.8.jar:0.2.8]
at com.alibaba.druid.filter.config.ConfigTools.decrypt(ConfigTools.java:126) ~[druid-0.2.8.jar:0.2.8]
at com.alibaba.druid.filter.config.ConfigTools.decrypt(ConfigTools.java:54) ~[druid-0.2.8.jar:0.2.8]
at com.alibaba.druid.filter.config.ConfigTools.decrypt(ConfigTools.java:48) ~[druid-0.2.8.jar:0.2.8]
at com.custom.common.jdbc.util.JdbcPasswordCallback.getPassword(JdbcPasswordCallback.java:19) ~[custom-commons-persistent.jar:na]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1273) [druid-0.2.8.jar:0.2.8]
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:1207) [druid-0.2.8.jar:0.2.8]
原因分析: Druid对数据库连接密码进行了加密,在配置文件中要填写加密后的密码,不能直接填写原始明文密码,否则在对连接密码进行解密时会报错。
解决方法:
方法一、配置文件中填写正确的加密后的密码
方法二、在druid配置中去除加密处理