while running the StartSonar.bat from command line I am getting the following error contineously.sonarqube log file is showing the below messages.
Any help is always appreciated!
--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2015.06.13 15:04:41 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[search]: C:\Program Files\Java\jdk1.8.0_45\jre\bin\java - Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=D:\sonarqube-5.1\sonarqube-5.1\temp -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer C:\Users\rkutchar\AppData\Local\Temp\sq-process3411693551115002418properties
2015.06.13 15:04:42 INFO es[o.s.p.ProcessEntryPoint] Starting search
2015.06.13 15:04:42 INFO es[o.s.s.SearchServer] Starting Elasticsearch[sonarqube] on port 9001
2015.06.13 15:04:42 INFO es[o.elasticsearch.node] [sonar-1434188081817] version[1.4.4], pid[7068], build[c88f77f/2015-02-19T13:05:36Z]
2015.06.13 15:04:42 INFO es[o.elasticsearch.node] [sonar-1434188081817] initializing ...
2015.06.13 15:04:42 INFO es[o.e.plugins] [sonar-1434188081817] loaded [], sites []
2015.06.13 15:04:43 INFO es[o.elasticsearch.node] [sonar-1434188081817] initialized
2015.06.13 15:04:43 INFO es[o.elasticsearch.node] [sonar-1434188081817] starting ...
2015.06.13 15:04:44 INFO es[o.e.transport] [sonar-1434188081817] bound_address {inet[/0.0.0.0:9001]}, publish_address {inet[/10.76.17.174:9001]}
2015.06.13 15:04:44 INFO es[o.e.discovery] [sonar-1434188081817] sonarqube/Y7PopLbZQ8Gqvlg6o70C3g
2015.06.13 15:04:47 INFO es[o.e.cluster.service] [sonar-1434188081817] new_master [sonar-1434188081817][Y7PopLbZQ8Gqvlg6o70C3g][DIN35003079][inet[/10.76.17.174:9001]]{rack_id=sonar-1434188081817}, reason: zen-disco-join (elected_as_master)
2015.06.13 15:04:47 INFO es[o.elasticsearch.node] [sonar-1434188081817] started
2015.06.13 15:04:47 INFO es[o.e.gateway] [sonar-1434188081817] recovered [6] indices into cluster_state
2015.06.13 15:04:48 INFO app[o.s.p.m.Monitor] Process[search] is up
2015.06.13 15:04:48 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[web]: C:\Program Files\Java\jdk1.8.0_45\jre\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=D:\sonarqube-5.1\sonarqube-5.1\temp -cp ./lib/common/*;./lib/server/*;D:\sonarqube-5.1\sonarqube-5.1\lib\jdbc\mysql\mysql-connector-java-5.1.34.jar org.sonar.server.app.WebServer C:\Users\rkutchar\AppData\Local\Temp\sq-process4890757865030388998properties
2015.06.13 15:04:49 INFO web[o.s.p.ProcessEntryPoint] Starting web
2015.06.13 15:04:49 INFO web[o.s.s.app.Webapp] Webapp directory: D:\sonarqube-5.1\sonarqube-5.1\web
2015.06.13 15:04:49 INFO web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.06.13 15:04:49 INFO web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2015.06.13 15:04:50 INFO web[o.e.plugins] [sonar-1434188081817] loaded [], sites []
2015.06.13 15:04:50 INFO web[o.s.s.p.ServerImpl] SonarQube Server / 5.1 / 4aa9af3a6a4362b61db365fba32eb0a55d411e7a
2015.06.13 15:04:50 INFO web[o.s.c.p.Database] Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
2015.06.13 15:04:50 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:117) ~[sonar-core-5.1.jar:na]
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:73) ~[sonar-core-5.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) ~[picocontainer-2.14.3.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91) ~[sonar-plugin-api-5.1.jar:na]
at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:96) ~[sonar-server-5.1.jar:na]
at org.sonar.server.platform.Platform.init(Platform.java:72) ~[sonar-server-5.1.jar:na]
at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-5.1.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'sonar'@'localhost' (using password: YES))
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-5.1.jar:na]
... 27 common frames omitted
Caused by: java.sql.SQLException: Access denied for user 'sonar'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:870) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2234) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_45]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_45]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) ~[mysql-connector-java-5.1.34.jar:5.1.34]
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.4.jar:1.4]
... 30 common frames omitted
2015.06.13 15:04:51 INFO web[jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b15 [Windows 7-amd64]
2015.06.13 15:04:51 INFO web[jruby.rack] using a shared (threadsafe!) runtime
EDIT:
apply plugin: "sonar-runner"
sonarRunner {
sonarProperties {
// can be also set on command line like - Dsonar.analysis.mode=incremental
property "sonar.host.url","http://localhost:9000"
property "sonar.jdbc.url","jdbc:mysql://sonar.someserver.int:3306/sonar"
property "sonar.jdbc.driverClassName","com.mysql.jdbc.Driver"
property "sonar.jdbc.username", "****"
property "sonar.jdbc.password", "****"
//I added these properties to my gradle.build
property "sonar.projectKey","com.example.rkutchar.myapplication"
property "sonar.projectName","MyApplication"
property "sonar.projectVersion","V1.0"
property "sonar.language","java"
property "sonar.sources","src/main/java"
property "sonar.binaries","build"
}
}
subprojects {
sonarRunner {
sonarProperties {
properties["sonar.sources"] += "src/main/java"
}
}
}
sonarRunner {
toolVersion = '2.4'
}
PROJECT.PROPERTIES FILE
# Required metadata
sonar.projectKey=MyApplication
sonar.projectName=My Application
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src/main/java
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8
conf/sonar-properties
#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- MySQl
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?
useUnicode=true&characterEncoding=utf8
#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#----- Global database settings
#sonar.jdbc.username=sonar
#sonar.jdbc.password=sonar
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
#----- Security (when 'sonar.forceAuthentication' is set to 'true')
#sonar.login=admin
#sonar.password=admin
It seems that the permissions are not correct on your database. You have to execute the following statement on your MySQL database:
GRANT ALL PRIVILEGES ON `sonar`.* TO 'sonar'@'localhost';