JHipster:无法初始化池:无法创建与数据库服务器的连接

时间:2018-09-15 14:43:11

标签: java mysql jhipster

我正在尝试在计算机上本地运行JHipster应用程序。我已经安装了MySQL Server,并通过MySQL Workbench导入了.sql文件。

但是,每次我在项目目录中运行mvnw时,都会得到:

    :: JHipster ?  :: Running Spring Boot 1.3.6.RELEASE ::
:: http://jhipster.github.io ::

2018-09-15 16:23:12.401  INFO 8296 --- [           main] com.myapp.ExampleApp                       : Starting MyApp on DESKTOP-JA21435 with PID 1234 (E:\My_projects\myapp\target\classes started by myName in E:\My_projects\myapp)
2018-09-15 16:23:12.401 DEBUG 8296 --- [           main] com.myapp.MyApp                       : Running with Spring Boot v1.3.6.RELEASE, Spring v4.2.7.RELEASE
2018-09-15 16:23:12.401  INFO 8296 --- [           main] com.myapp.MyApp                       : The following profiles are active: swagger,dev
2018-09-15 16:23:15.051 DEBUG 8296 --- [kground-preinit] org.jboss.logging                        : Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2018-09-15 16:23:18.650 DEBUG 8296 --- [           main] com.myapp.config.AsyncConfiguration      : Creating Async Task Executor
2018-09-15 16:23:19.428 DEBUG 8296 --- [           main] com.myapp.config.MetricsConfiguration    : Registering JVM gauges
2018-09-15 16:23:19.443 DEBUG 8296 --- [           main] com.myapp.config.MetricsConfiguration    : Initializing Metrics JMX reporting
2018-09-15 16:23:21.774  INFO 8296 --- [ost-startStop-1] com.myapp.config.WebConfigurer           : Web application configuration, using profiles: [swagger, dev]
2018-09-15 16:23:21.774 DEBUG 8296 --- [ost-startStop-1] com.myapp.config.WebConfigurer           : Initializing Metrics registries
2018-09-15 16:23:21.790 DEBUG 8296 --- [ost-startStop-1] com.myapp.config.WebConfigurer           : Registering Metrics Filter
2018-09-15 16:23:21.790 DEBUG 8296 --- [ost-startStop-1] com.myapp.config.WebConfigurer           : Registering Metrics Servlet
2018-09-15 16:23:21.790  INFO 8296 --- [ost-startStop-1] com.myapp.config.WebConfigurer           : Web application fully configured
2018-09-15 16:23:22.370 DEBUG 8296 --- [ost-startStop-1] com.myapp.config.DatabaseConfiguration   : Configuring Datasource
2018-09-15 16:23:22.887 DEBUG 8296 --- [ost-startStop-1] com.myapp.config.DatabaseConfiguration   : Configuring Liquibase
2018-09-15 16:23:22.919  WARN 8296 --- [argo-Executor-1] c.c.c.liquibase.AsyncSpringLiquibase     : Starting Liquibase asynchronously, your database might not be ready at startup!
2018-09-15 16:23:24.097 ERROR 8296 --- [argo-Executor-1] c.c.a.ExceptionHandlingAsyncTaskExecutor : Caught async exception

com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server.
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:528)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:118)
        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:94)
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
        at com.myapp.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:66)
        at com.myapp.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:49)
        at com.myapp.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:47)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: 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(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

我的application-dev文件中的数据源信息具有以下几行,分别对应于我的PC上设置的MySQL用户名和密码:

datasource:
        url: jdbc:mysql://localhost:3306/myApp?useUnicode=true&characterEncoding=utf8&useSSL=false
        name:
        username: root
        password: root
        hikari:
            data-source-properties:
                cachePrepStmts: true
                prepStmtCacheSize: 250
                prepStmtCacheSqlLimit: 2048
                useServerPrepStmts: true

任何帮助或指出可能是问题的指针。

0 个答案:

没有答案