seata 1.4.2 执行seata-server.bat报错:Could not create connection to database server.

seata 1.4.2 执行seata-server.bat报错

18:40:17.778 ERROR --- [tionPool-Create-343563528] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql://139.224.47.100:3306/seata, errorCode 0, state 08001
==>
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_291]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_291]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_291]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_291]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:389) ~[na:na]
        at com.mysql.jdbc.Util.getInstance(Util.java:372) ~[na:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:958) ~[na:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:937) ~[na:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) ~[na:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:872) ~[na:na]
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2316) ~[na:na]
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069) ~[na:na]
        at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:794) ~[na:na]
        at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:44) ~[na:na]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_291]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_291]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_291]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_291]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:389) ~[na:na]
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) ~[na:na]
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) ~[na:na]
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644) ~[druid-1.1.23.jar:1.1.23]
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710) ~[druid-1.1.23.jar:1.1.23]
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774) ~[druid-1.1.23.jar:1.1.23]
Caused by: java.lang.NullPointerException: null
        at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:2989) ~[na:na]
        at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1873) ~[na:na]
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1802) ~[na:na]
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206) ~[na:na]
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2239) ~[na:na]
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270) ~[na:na]
        ... 13 common frames omitted

解决方案 

2.1)如果你用的是mysql 5.x版本则将store.db.driverClassName 设置为

store.db.driverClassName=com.mysql.jdbc.Driver

2.2)如果你用的mysql 8.x版本则将store.db.driverClassName设置为

store.db.driverClassName=com.mysql.cj.jdbc.Driver

 总结:需要mysql版本和驱动类保持一致。

你可能感兴趣的:(数据库,java,分布式)