ERROR: Elasticsearch exited unexpectedly, with exit code 1

I installed sonarqube-10.4.0.87286 and sonar-scanner-6.1.0.83647-net-framework via zip files.
I’ve verified echo %JAVA_HOME%
C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot\bin

Please help me to get SonarQube working.

When I try to run the StartSonar.bat I get the following error:

2024.09.09 08:59:21 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
ERROR: Elasticsearch did not exit normally - check the logs at C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\logs\sonarqube.log

ERROR: Elasticsearch exited unexpectedly, with exit code 1
2024.09.09 08:59:24 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2024.09.09 08:59:24 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2024.09.09 08:59:24 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

sonar.log:

2024.09.09 08:59:21 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\temp
2024.09.09 08:59:21 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:62364]
2024.09.09 08:59:21 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\elasticsearch]: C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot\bin\java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\elasticsearch -Des.path.conf=C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\temp\conf\es -Des.distribution.type=tar -cp C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\elasticsearch\lib\*;C:\SonarQube\sonarqube-10.4.0.87286\sonarqube-10.4.0.87286\elasticsearch\lib\cli-launcher\* org.elasticsearch.launcher.CliToolLauncher
2024.09.09 08:59:21 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2024.09.09 08:59:24 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2024.09.09 08:59:24 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2024.09.09 08:59:24 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

es.log:

2024.09.09 08:59:24 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.IllegalStateException: jar hell!
class: com.ibm.db2.jcc.licenses.DB2J
jar1: C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cisuz.jar
jar2: C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar
	at org.elasticsearch.jdk.JarHell.checkClass(JarHell.java:315) ~[elasticsearch-core-8.11.0.jar:?]
	at org.elasticsearch.jdk.JarHell.checkJarHell(JarHell.java:233) ~[elasticsearch-core-8.11.0.jar:?]
	at org.elasticsearch.jdk.JarHell.checkJarHell(JarHell.java:84) ~[elasticsearch-core-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:181) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:72) ~[elasticsearch-8.11.0.jar:?]

These don’t look like any JARs SonarQube would be familiar with.

Are these possibly referenced in some environment variable like JAVA_OPTS or JAVA_TOOL_OPTIONS?

I do not have the environment variables JAVA_OPTS or JAVA_TOOL_OPTIONS set. I did find where the paths are coming from. My environment variable ClassPath is set to the following paths and it is used for my IMB DB2 tools.
image

Is there away to work around this without causing issues with my DB2 tools?

Well, just within the context of a single command session you could run

set CLASSPATH=

But I’m not really sure what you should do in the longterm, or how having these set affect your DB2 tools (I’m not a DB2 expert)

Morning Colin, Setting the ClassPath to empty in the command window worked and I was able to run the StartSonar.bat file to start SonarQube. I opened localhost:9000 and generated a token. I entered the token in the SonarQube.Analysis.xml. To this point everything is good. Then I open a new command window and run the line commands from the localhost and when I run the command SonarScanner.MSBuild.exe end /d:sonar.token=“” it fails with the following error.

ERROR: Error during SonarScanner execution
ERROR: Not authorized. Please check the user token in the property 'sonar.token' or the credentials in the properties 'sonar.login' and 'sonar.password'.
ERROR:
The SonarScanner did not complete successfully
11:41:54.36  Post-processing failed. Exit code: 1

The only log file I can find an error in is the web.log

2024.09.18 11:24:00 ERROR web[8460c1af-7eeb-4405-9bba-d406f0badd94][o.s.s.p.UpdateCenterClient] Fail to connect to update center
org.sonar.api.utils.SonarException: Fail to download: https://downloads.sonarsource.com/sonarqube/update/update-center.properties
	at org.sonar.core.util.DefaultHttpDownloader.failToDownload(DefaultHttpDownloader.java:153)
	at org.sonar.core.util.DefaultHttpDownloader.readString(DefaultHttpDownloader.java:99)
	at org.sonar.api.utils.UriReader.readString(UriReader.java:69)
	at org.sonar.server.plugins.UpdateCenterClient.init(UpdateCenterClient.java:113)`

Hey @WayneFossette

Feel free to start a new topic if you got SonarQube up and running, and now you’re trying to analyze code.