StartSonar.bat cannot start in Sonarqube. Win10
Problem Description and Final Solution
1. Download MySql 5.7.23, Sonar 6.7.5
2. Following the installation documents on the Internet, the Sonar database is established first, and then the configuration files are modified.
3. Always report errors when the result starts.
2018.10.22 12:19:16 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory E:\sonarqube-6.7.5\temp 2018.10.22 12:19:16 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 2018.10.22 12:19:16 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [E:\sonarqube-6.7.5\elasticsearch]: E:\Program Files\Java\jdk1.8\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=E:\sonarqube-6.7.5\elasticsearch -cp lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.conf=E:\sonarqube-6.7.5\temp\conf\es INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running INFO app[][o.e.p.PluginsService] no modules loaded INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] INFO app[][o.s.a.SchedulerImpl] Process[es] is up INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [E:\sonarqube-6.7.5]: E:\Program Files\Java\jdk1.8\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=E:\sonarqube-6.7.5\temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*;./lib/server/*;E:\sonarqube-6.7.5\lib\jdbc\mysql\mysql-connector-java-5.1.42.jar org.sonar.server.app.WebServer E:\sonarqube-6.7.5\temp\sq-process1786107185523570293properties INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped WARN app[][o.e.t.n.Netty4Transport] exception caught on transport layer [[id: 0x730a13cc, L:/127.0.0.1:56461 - R:/127.0.0.1:9001]], closing connection java.io.IOException: The remote host forced an existing connection to be closed. at sun.nio.ch.SocketDispatcher.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(Unknown Source) at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source) at sun.nio.ch.IOUtil.read(Unknown Source) at sun.nio.ch.SocketChannelImpl.read(Unknown Source) at ...
4. According to the online solutions have not been solved, try for half a day. Suddenly I saw a problem that Process[es] startup was normal at first, but Process [web] startup had problems.
app[][o.s.a.SchedulerImpl] Process[es] is up ... app[][o.s.a.SchedulerImpl] Process [web] is stopped
5. So I went to the web log filelogweb.log and found the problem.
2018.10.22 10:52:36 INFO web[][o.s.p.ProcessEntryPoint] Starting web 2018.10.22 10:52:37 ERROR web[][o.a.c.h.Http11NioProtocol] Failed to initialize end point associated with ProtocolHandler ["http-nio-0.0.0.0-9000"] java.net.BindException: Address already in use: bind
6. The original port 9000 is occupied by other programs, and then it will be easy. Finding that program takes up this port.
E:\Program Files\Java\jdk1.8.0_191\bin>netstat -aon|findstr "9000" Protocol Local Address External Address State PID TCP 0.0.0.0:9000 0.0.0.0:0 LISTENING 34104
E:\Program Files\Java\jdk1.8.0_191\bin>tasklist|findstr "34104" eclipse.exe 34104 Console 1 106,552 K
7. Close the program and restart startsonar.bat to solve the problem.
Establishing Sonar database
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'sonar' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
Modify the configuration file conf sonar. properties
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false sonar.jdbc.username=sonar sonar.jdbc.password=sonar sonar.jdbc.driverClassName=com.mysql.jdbc.Driver sonar.web.port=9000