SoJpt

SojptUtils 无法创建数据库连接

我的环境:

jdk版本:1.8

mysql版本:8.0

我的sys_config.properties配置如下:

image.png

报错如下:

[ERROR]-[Thread: JavaFX Application Thread]-[com.alibaba.druid.pool.DruidDataSource.init()]: init datasource error, url: jdbc:mysql://localhost/activiti_k?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

        at java.lang.reflect.Constructor.newInstance(Unknown Source)

        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

        at com.mysql.jdbc.Util.getInstance(Util.java:387)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:917)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)

        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2332)

        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)

        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)

        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

        at java.lang.reflect.Constructor.newInstance(Unknown Source)

        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)

        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)

        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1421)

        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1477)

        at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:684)

        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:991)

        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:987)

        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:103)

        at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43)

        at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226)

        at com.sohnny.util.dataBase.MySqlSchema.start(MySqlSchema.java:122)

        at com.sohnny.utils.template.GeneratorView.init(GeneratorView.java:34)

        at application.view.SoJCodeGeneratorController.initialize(SoJCodeGeneratorController.java:104)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.Trampoline.invoke(Unknown Source)

        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.MethodUtil.invoke(Unknown Source)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

        at application.view.IndexController.initialize(IndexController.java:35)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.Trampoline.invoke(Unknown Source)

        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.MethodUtil.invoke(Unknown Source)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

        at application.Main.start(Main.java:20)

        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)

        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)

        at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)

        at java.security.AccessController.doPrivileged(Native Method)

        at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)

        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)

        at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NullPointerException

        at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:3005)

        at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1916)

        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1845)

        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1215)

        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255)

        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)

        ... 66 more


2019-05-10 10:31:01

[ERROR]-[Thread: JavaFX Application Thread]-[com.alibaba.druid.pool.DruidDataSource.init()]: {dataSource-1} init error

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

        at java.lang.reflect.Constructor.newInstance(Unknown Source)

        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

        at com.mysql.jdbc.Util.getInstance(Util.java:387)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:917)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)

        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2332)

        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)

        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)

        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

        at java.lang.reflect.Constructor.newInstance(Unknown Source)

        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)

        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)

        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1421)

        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1477)

        at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:684)

        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:991)

        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:987)

        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:103)

        at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43)

        at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226)

        at com.sohnny.util.dataBase.MySqlSchema.start(MySqlSchema.java:122)

        at com.sohnny.utils.template.GeneratorView.init(GeneratorView.java:34)

        at application.view.SoJCodeGeneratorController.initialize(SoJCodeGeneratorController.java:104)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.Trampoline.invoke(Unknown Source)

        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.MethodUtil.invoke(Unknown Source)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

        at application.view.IndexController.initialize(IndexController.java:35)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.Trampoline.invoke(Unknown Source)

        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at sun.reflect.misc.MethodUtil.invoke(Unknown Source)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

        at application.Main.start(Main.java:20)

        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)

        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)

        at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)

        at java.security.AccessController.doPrivileged(Native Method)

        at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)

        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)

        at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NullPointerException

        at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:3005)

        at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1916)

        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1845)

        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1215)

        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255)

        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)

        ... 66 more


2019-05-10 10:31:01

[INFO]-[Thread: JavaFX Application Thread]-[com.alibaba.druid.pool.DruidDataSource.init()]: {dataSource-1} inited

javafx.fxml.LoadException:

file:/D:/Kalvin/%e8%bd%af%e4%bb%b6/Soutils-1.2/Soutils-v1.2.jar!/application/view/SoJCodeGenerator.fxml


        at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2571)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

2019-05-10 10:31:01

mysql服务能正常访问如下:

image.png

求助,怎么解决?

评论

  • 05-10 15:13
    mysql 8.0驱动升级了, soutils1.2内置驱动不支持8.0, 等我升级吧, 有可能今晚有时间就升了
  • 05-10 19:10
    soutils1.3兼容mysql8.0, 已上传qq群, 可在群内下载内测版.
  • 发送