How to setup SonarQube on Windows

Here is my environment:
OS: Windows 10
SonarQube: sonarqube-9.0.0.45539
JDK: Version jdk-11.0.12
HTTP Server: Apache

I am trying to run SonarQube on my computer but I am not able to.
I have addressed many of the issues.
When I type http://localhost:9001 I see the following:

Here is the screen when I run the StartSonar batch file

{
  "name" : "sonarqube",
  "cluster_name" : "sonarqube",
  "cluster_uuid" : "IIT8cuODQEm_tHyAzkb-wA",
  "version" : {
    "number" : "7.12.1",
    "build_flavor" : "unknown",
    "build_type" : "unknown",
    "build_hash" : "3186837139b9c6b6d23c3200870651f10d3343b7",
    "build_date" : "2021-04-20T20:56:39.040728659Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

My Command prompt after running StartSonar batch file is as follows:

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    | 2021.07.22 20:00:53 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\sonarqube-9.0.0.45539\var\sonarqube\temp
jvm 1    | 2021.07.22 20:00:53 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:52237]
jvm 1    | 2021.07.22 20:00:53 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [C:\sonarqube-9.0.0.45539\elasticsearch]: C:\Program Files\Java\jdk-11.0.12\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.io.tmpdir=C:\sonarqube-9.0.0.45539\var\sonarqube\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.locale.providers=COMPAT -Des.enforce.bootstrap.checks=true -Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\sonarqube-9.0.0.45539\elasticsearch -Des.path.conf=C:\sonarqube-9.0.0.45539\var\sonarqube\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
jvm 1    | 2021.07.22 20:00:53 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1    | Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
jvm 1    | 2021.07.22 20:01:01 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
jvm 1    | 2021.07.22 20:01:01 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [C:\sonarqube-9.0.0.45539]: C:\Program Files\Java\jdk-11.0.12\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\sonarqube-9.0.0.45539\var\sonarqube\temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.0.0.45539.jar;C:\sonarqube-9.0.0.45539\lib\jdbc\postgresql\postgresql-42.2.19.jar org.sonar.server.app.WebServer C:\sonarqube-9.0.0.45539\var\sonarqube\temp\sq-process6922738420692722088properties

When I attempt to access http://localhost:9000 I get:

# This site can’t be reached

localhost refused to connect.

Try:

* Checking the connection
* [Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons)

ERR_CONNECTION_REFUSED

Please help.

Hi,

Welcome to the community!

How come you’re trying to access port 9001? That’s the port that SonarQube spins up its embedded Elasticsearch on. SonarQube itself is on port 9000.

 
Ann

I was testing to see whether any of the two ports (9000 and 9001) were working.
Do you know what could be wrong?

Hi,

Okay, that makes sense. It’s time to check your server logs.

 
Ann

Hi Ann

I am now cooking with gas:

The issue was with my database setup.

Best regards

AHirsi

1 Like