SonarQube-7.9.1 will not start on Windows 7 even though I have the correct Java version

  1. Steps to reproduce

I have SonarQube and OpenJDK on my Windows 7 machine installed on my non bootable E drive. I’m reading the book Continuous Integration Delivery and Deployment by Sander Rossel but are stuck on where I have to install SonarQube. Windows won’t start the service.

I have installed Java on my E drive instead of my non bootable C drive. From the website https:/​/​www.​sonarqube.​org/​downloads. Unzip the contents of the zip file and put them somewhere. I simply unzipped the sonarqube-6.2 folder to E: drive. Now, we need to hook up SonarQube to the database.

Open C:\sonarqube-6.2\conf\sonar.properties (or wherever you have unzipped it) and change sonar.jdbc.username= and sonar.jdbc.password= to sonar.jdbc.username=sonar and sonar.jdbc.password=sonar.

After that, scroll further down the file and you will find the settings for PostgreSQL. The only thing you need to do is uncomment the line

#sonar.jdbc.url=jdbc:postgresql://localhost/sonar by removing # .

Now, if you go to C:\sonarqube-6.2\bin\windows-x86-64 (replace Windows-x86-x64 with your own OS), you will find some .bat files. To start SonarQube, simply run StartSonar.bat ; to install SonarQube as a service, run InstallNTService.bat (with administrative privileges); and to start the service, run StartNTService.bat (also with administrative privileges). Using a browser, browse to localhost:9000 and you should

see SonarQube.

  1. Expected behavior

After successfully installing “InstallNTService.bat” and then going to “StartNTService.bat” I should be greeted with a successful boot time installation of Sonar Cube, right?

  1. Actual behavior

Wrong! When I go inside the Sonar Cube “bin\windows-x86-64” installation directory and hit StartNTService.bat. the console reports this.

sonar.txt <----------ERROR LOG

Starting the SonarQube service...
--> Wrapper Started as Service
Launching a JVM...
Unable to execute Java command.  The system cannot find the file specified. (0x2)
    "java" -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -Xmx32m -Djava.library.path="./lib" -classpath "../../lib/jsw/wrapper-3.2.3.jar;../../lib/common/activation-1.1.jar;../../lib/common/commons-codec-1.12.jar;../../lib/common/commons-csv-1.4.jar;../../lib/common/commons-dbcp2-2.5.0.jar;../../lib/common/commons-dbutils-1.5.jar;../../lib/common/commons-email-1.5.jar;../../lib/common/commons-io-2.6.jar;../../lib/common/commons-lang-2.6.jar;../../lib/common/commons-logging-1.2.jar;../../lib/common/commons-pool2-2.6.0.jar;../../lib/common/diffutils-1.2.jar;../../lib/common/elasticsearch-6.8.0.jar;../../lib/common/elasticsearch-cli-6.8.0.jar;../../lib/common/elasticsearch-core-6.8.0.jar;../../lib/common/elasticsearch-secure-sm-6.8.0.jar;../../lib/common/elasticsearch-x-content-6.8.0.jar;../../lib/common/gson-2.8.4.jar;../../lib/common/guava-18.0.jar;../../lib/common/hazelcast-3.8.6.jar;../../lib/common/hazelcast-client-3.8.6.jar;../../lib/common/HdrHistogram-2.1.9.jar;../../lib/common/hppc-0.7.1.jar;../../lib/common/httpclient-4.5.2.jar;../../lib/common/httpcore-4.4.4.jar;../../lib/common/jackson-annotations-2.9.8.jar;../../lib/common/jackson-core-2.9.8.jar;../../lib/common/jackson-databind-2.9.8.jar;../../lib/common/jackson-dataformat-cbor-2.8.11.jar;../../lib/common/jackson-dataformat-smile-2.8.11.jar;../../lib/common/jackson-dataformat-yaml-2.8.11.jar;../../lib/common/javax.mail-1.5.6.jar;../../lib/common/jaxb-api-2.3.0.jar;../../lib/common/jbcrypt-0.4.jar;../../lib/common/jjwt-api-0.10.5.jar;../../lib/common/jjwt-impl-0.10.5.jar;../../lib/common/jjwt-jackson-0.10.5.jar;../../lib/common/jna-4.5.1.jar;../../lib/common/joda-time-2.10.1.jar;../../lib/common/jopt-simple-5.0.2.jar;../../lib/common/jul-to-slf4j-1.7.25.jar;../../lib/common/log4j-api-2.8.2.jar;../../lib/common/log4j-to-slf4j-2.8.2.jar;../../lib/common/logback-access-1.2.3.jar;../../lib/common/logback-classic-1.2.3.jar;../../lib/common/logback-core-1.2.3.jar;../../lib/common/lucene-analyzers-common-7.7.0.jar;../../lib/common/lucene-backward-codecs-7.7.0.jar;../../lib/common/lucene-core-7.7.0.jar;../../lib/common/lucene-grouping-7.7.0.jar;../../lib/common/lucene-highlighter-7.7.0.jar;../../lib/common/lucene-join-7.7.0.jar;../../lib/common/lucene-memory-7.7.0.jar;../../lib/common/lucene-misc-7.7.0.jar;../../lib/common/lucene-queries-7.7.0.jar;../../lib/common/lucene-queryparser-7.7.0.jar;../../lib/common/lucene-sandbox-7.7.0.jar;../../lib/common/lucene-spatial-7.7.0.jar;../../lib/common/lucene-spatial-extras-7.7.0.jar;../../lib/common/lucene-spatial3d-7.7.0.jar;../../lib/common/lucene-suggest-7.7.0.jar;../../lib/common/lz4-1.3.0.jar;../../lib/common/mybatis-3.5.1.jar;../../lib/common/nanohttpd-2.3.0.jar;../../lib/common/netty-buffer-4.1.32.Final.jar;../../lib/common/netty-codec-4.1.32.Final.jar;../../lib/common/netty-codec-http-4.1.32.Final.jar;../../lib/common/netty-common-4.1.32.Final.jar;../../lib/common/netty-handler-4.1.32.Final.jar;../../lib/common/netty-resolver-4.1.32.Final.jar;../../lib/common/netty-transport-4.1.32.Final.jar;../../lib/common/okhttp-3.14.2.jar;../../lib/common/okio-1.17.2.jar;../../lib/common/parent-join-client-6.8.0.jar;../../lib/common/percolator-client-6.8.0.jar;../../lib/common/picocontainer-2.15.jar;../../lib/common/protobuf-java-3.7.0.jar;../../lib/common/slf4j-api-1.7.25.jar;../../lib/common/snakeyaml-1.17.jar;../../lib/common/sonar-ce-7.9.1.jar;../../lib/common/sonar-ce-common-7.9.1.jar;../../lib/common/sonar-ce-task-7.9.1.jar;../../lib/common/sonar-ce-task-projectanalysis-7.9.1.jar;../../lib/common/sonar-channel-4.1.jar;../../lib/common/sonar-check-api-7.9.1.jar;../../lib/common/sonar-classloader-1.0.jar;../../lib/common/sonar-core-7.9.1.jar;../../lib/common/sonar-db-core-7.9.1.jar;../../lib/common/sonar-db-dao-7.9.1.jar;../../lib/common/sonar-db-migration-7.9.1.jar;../../lib/common/sonar-duplications-7.9.1.jar;../../lib/common/sonar-main-7.9.1.jar;../../lib/common/sonar-markdown-7.9.1.jar;../../lib/common/sonar-plugin-api-7.9.1-all.jar;../../lib/common/sonar-plugin-api-7.9.1.jar;../../lib/common/sonar-process-7.9.1.jar;../../lib/common/sonar-scanner-protocol-7.9.1.jar;../../lib/common/sonar-server-7.9.1.jar;../../lib/common/sonar-server-common-7.9.1.jar;../../lib/common/sonar-update-center-common-1.18.0.487.jar;../../lib/common/sonar-ws-7.9.1.jar;../../lib/common/stax2-api-3.1.4.jar;../../lib/common/staxmate-2.0.1.jar;../../lib/common/t-digest-3.2.jar;../../lib/common/tomcat-annotations-api-8.5.38.jar;../../lib/common/tomcat-embed-core-8.5.38.jar;../../lib/common/transport-6.8.0.jar;../../lib/common/transport-netty4-client-6.8.0.jar;../../lib/common/woodstox-core-lgpl-4.4.0.jar;../../lib/sonar-application-7.9.1.jar;../../lib/sonar-shutdowner-7.9.1.jar" -Dwrapper.key="woq2x1emV83h4Fnk" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=3540 -Dwrapper.version="3.2.3" -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.sonar.application.App
Critical error: wait for JVM process failed
The SonarQube service was launched, but failed to start.
  1. Environment data

sonarqube-7.9.1

java --version

openjdk 11.0.2 2019-01-15

OpenJDK Runtime Environment 18.9 (build 11.0.2+9)

OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

OS Name: Windows

OS Version: 6.1.7601

OS Platform: Windows

RID: win7-x64

This means that the Java bin folder is not in the PATH env var of the process used to run the service.
It will be much easier to specity the full path to “java.exe” in the proper configuration file.

2 Likes

Still not working. Strange. I had already set up a full path to java in a variable I called JAVA_HOME without the bin subfolder and then referenced it in the PATH variable with this value %JAVA_HOME%\bin. I can confirm both variables work and have deliberately mistyped the paths to be certain as the information you see in the Environment Data section successfully returns the version info after I type java –version.

Proper configuration file? You mean wrapper.conf with these two uncommented lines?

wrapper.java.command=%JAVA_HOME%\bin

wrapper.java.command=java

Yes they are both uncommented. And before you ask, I have actually put in the full path to my bin folder instead of the variable name just to be certain. Same result.

Please also try with:
wrapper.java.command=%JAVA_HOME%\bin\java.exe

Also, it doesn’t make sense to have multiple uncommented wrapper.java.command lines, please leave only one.

Darn it, Sonar woudln’t accept “%JAVA_HOME%\bin\java.exe” even though the variable already works! Anyway I commented out that other command and instead put in the full path to the java executable. Thanks it appears to be starting now. You’ve solved my problem but I feel the need to elaborate on problems that occured after and what I did the fix it.

Anyway after a few seconds the process stoped. I forgot to say, I was attempting to hook up Postgres to Sonar and it hooks up via pgAdmin. pgAdmin is reporting the database is being connected to. So I have provided these 3 lines in the file sonar.properties

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube?currentSchema=my_schema

In web.txt an error that stood out in that log output was FATAL: database "sonarqube" does not exist. The book I’m reading had a line similar to the third line in sonar.properties but the database was called “sonar”). Anyway I renamed the third line in my sonar.properties files to this

sonar.jdbc.url=jdbc:postgresql://localhost/sonar

It works now.

Thank you for the feedback.

Regarding Postgres, pgadmin should provide the list of existing databases; if not, DBeaver works just fine (community edition).

1 Like