无法连接到数据库声纳

时间:2018-09-12 05:01:48

标签: mysql sonarqube

我正在尝试在Windows 10上启动SonarQube(sonarqube-7.1)服务器,但无法连接到数据库MySql(5.7.23),这将引发错误-

wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | 2018.09.12 10:16:47 INFO  app[][o.s.a.AppFileSystem] Cleaning or 
creating temp directory C:\sonar\sonarqube-7.1\temp
jvm 1    | 2018.09.12 10:16:47 INFO  app[][o.s.a.es.EsSettings] 
Elasticsearch listening on /127.0.0.1:9001
jvm 1    | 2018.09.12 10:16:48 INFO  app[][o.s.a.p.ProcessLauncherImpl] 
Launch 
process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from 
[C:\sonar\sonarqube- 
7.1\elasticsearch]: C:\Program Files\Java\jre1.8.0_171\bin\java - 
XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 - 
XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m - 
Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true - 
Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true - 
Dio.netty.noKeySetOptimization=true - 
Dio.netty.recycler.maxCapacityPerThread=0 - 
Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true - 
Dlog4j.skipJansi=true -Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError - 
Delasticsearch -Des.path.home=C:\sonar\sonarqube-7.1\elasticsearch -cp lib/* 
org.elasticsearch.bootstrap.Elasticsearch -Epath.conf=C:\sonar\sonarqube- 
7.1\temp\conf\es
jvm 1    | 2018.09.12 10:16:48 INFO  app[][o.s.a.SchedulerImpl] Waiting for 
Elasticsearch to be up and running
jvm 1    | 2018.09.12 10:16:48 INFO  app[][o.e.p.PluginsService] no modules 
loaded
jvm 1    | 2018.09.12 10:16:48 INFO  app[][o.e.p.PluginsService] loaded 
plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1    | 2018.09.12 10:16:53 INFO  app[][o.s.a.SchedulerImpl] Process[es] 
is up
jvm 1    | 2018.09.12 10:16:53 INFO  app[][o.s.a.p.ProcessLauncherImpl] 
Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from 
[C:\sonar\sonarqube-7.1]: C:\Program Files\Java\jre1.8.0_171\bin\java - 
Djava.awt.headless=true -Dfile.encoding=UTF-8 - 
Djava.io.tmpdir=C:\sonar\sonarqube-7.1\temp -Xmx512m -Xms128m - 
XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*;C:\sonar\sonarqube- 
7.1\lib\jdbc\mysql\mysql-connector-java-5.1.42.jar 
org.sonar.server.app.WebServer C:\sonar\sonarqube-7.1\temp\sq- 
process8609453804278157052properties
jvm 1    | 2018.09.12 10:16:58 INFO  app[][o.s.a.SchedulerImpl] Process 
[web] is stopped
jvm 1    | 2018.09.12 10:16:58 INFO  app[][o.s.a.SchedulerImpl] Process [es] 
is stopped
jvm 1    | 2018.09.12 10:16:58 INFO  app[][o.s.a.SchedulerImpl] SonarQube is 
stopped
wrapper  | <-- Wrapper Stopped

我的sonar.properties看起来像这样

# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC 
user.
# The schema must be created first.
sonar.jdbc.username=root
sonar.jdbc.password=admin

#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092

#----- MySQL 5.6 or greater
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be changed.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
# Web context. When set, it must start with forward slash (for example 
/sonarqube).
# The default value is root context (empty value).
#sonar.web.context=
# TCP port for incoming HTTP connections. Default value is 9000.
sonar.web.port=9090

web.log中的错误看起来像这样

2018.09.12 10:16:54 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2018.09.12 10:16:54 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared 
selector for servlet write/read
2018.09.12 10:16:55 INFO  web[][o.e.p.PluginsService] no modules loaded
2018.09.12 10:16:55 INFO  web[][o.e.p.PluginsService] loaded plugin 
[org.elasticsearch.join.ParentJoinPlugin]
2018.09.12 10:16:55 INFO  web[][o.e.p.PluginsService] loaded plugin 
[org.elasticsearch.percolator.PercolatorPlugin]
2018.09.12 10:16:55 INFO  web[][o.e.p.PluginsService] loaded plugin 
[org.elasticsearch.transport.Netty4Plugin]
2018.09.12 10:16:55 INFO  web[][o.s.s.e.EsClientProvider] Connected to 
local Elasticsearch: [127.0.0.1:9001]
2018.09.12 10:16:55 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server 
/ 7.1.0.11001 / 9f47ce9daecebb16fc777249a418252625ae774a
2018.09.12 10:16:55 INFO  web[][o.sonar.db.Database] Create JDBC data 
source for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
2018.09.12 10:16:57 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Can not connect to database. Please check 
connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:108)
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:75)
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 org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:170)
at org.sonar.server.platform.Platform.init(Platform.java:86)
at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (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.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:322)
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:106)
... 29 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.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.
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:425)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2192)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2225)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2024)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
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:425)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 34 common frames omitted
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
... 50 common frames omitted

我还添加了具有所有特权的声纳数据库。 我缺少什么,为什么它无法连接数据库? 预先感谢。

0 个答案:

没有答案