First run with sonar

Hello!
I’m new in sonar.

I download sonarqube-10.4.0.87286.zip, installed jdk-21.0.2, and configured the conexion to database: sonar.embeddedDatabase.port=9092.

When run StartSonar.bat, this happens

2024.02.21 19:25:24 WARN  es[][o.e.c.InternalClusterInfoService] failed to retrieve stats for node [rQ0wlx7zQdmhwLPsTPS0Rw]
org.elasticsearch.transport.RemoteTransportException: [sonarqube][127.0.0.1:53807][cluster:monitor/nodes/stats[n]]
Caused by: org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2024-02-21T17:21:47.5486777Z, (lock=NativeFSLock(path=C:\raul\sonarqube-10.4.0.87286\data\es8\node.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],creationTime=2024-02-21T16:58:49.8020513Z))
	at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:179) ~[lucene-core-9.8.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment.assertEnvIsLocked(NodeEnvironment.java:1290) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment.dataPaths(NodeEnvironment.java:1086) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.monitor.fs.FsProbe.stats(FsProbe.java:46) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService$FsInfoCache.refresh(FsService.java:93) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService$FsInfoCache.refresh(FsService.java:79) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.common.util.SingleObjectCache.getOrRefresh(SingleObjectCache.java:42) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService.lambda$new$1(FsService.java:57) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService.stats(FsService.java:67) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.node.NodeService.stats(NodeService.java:184) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.action.admin.cluster.node.stats.TransportNodesStatsAction.nodeOperation(TransportNodesStatsAction.java:84) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.action.admin.cluster.node.stats.TransportNodesStatsAction.nodeOperation(TransportNodesStatsAction.java:33) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.action.support.nodes.TransportNodesAction$NodeTransportHandler.messageReceived(TransportNodesAction.java:204) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:1020) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.11.0.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1583) ~[?:?]
2024.02.21 19:25:26 WARN  es[][o.a.l.i.v.VectorizationProvider] Java vector incubator module is not readable. For optimal vector performance, pass --add-modules jdk.incubator.vector to enable Vector API.
2024.02.21 19:25:26 INFO  es[][o.e.n.Node] version[8.11.0], pid[1776], build[tar/d9ec3fa628c7b0ba3d25692e277ba26814820b20/2023-11-04T10:04:57.184859352Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/21.0.2/21.0.2+13-LTS-58]
2024.02.21 19:25:26 INFO  es[][o.e.n.Node] JVM home [C:\raul\jdk-21.0.2], using bundled JDK [false]
2024.02.21 19:25:26 INFO  es[][o.e.n.Node] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -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, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=org.elasticsearch.preallocate, -XX:+UseG1GC, -Djava.io.tmpdir=C:\raul\sonarqube-10.4.0.87286\temp, -XX:ErrorFile=C:\raul\sonarqube-10.4.0.87286\logs\es_hs_err_pid%p.log, -Xlog:disable, -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, -Djna.tmpdir=C:\raul\sonarqube-10.4.0.87286\temp, -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, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=COMPAT, -Dcom.redhat.fips=false, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=tar, --module-path=C:\raul\sonarqube-10.4.0.87286\elasticsearch\lib, --add-modules=jdk.net, --add-modules=ALL-MODULE-PATH, -Djdk.module.main=org.elasticsearch.server, -agentpath:C:\Program Files\Palo Alto Networks\Traps\cyjagent.dll]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-core]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [old-lucene-versions]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [rest-root]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-redact]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-security]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [aggregations]
2024.02.21 19:25:27 INFO  es[][o.e.p.PluginsService] loaded module [apm]
2024.02.21 19:25:29 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.IllegalStateException: failed to obtain node locks, tried [C:\raul\sonarqube-10.4.0.87286\data\es8]; maybe these locations are not writable or multiple nodes were started on the same data path?
	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:294) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.node.Node.<init>(Node.java:499) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.node.Node.<init>(Node.java:344) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch$2.<init>(Elasticsearch.java:236) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:236) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-8.11.0.jar:?]
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock held by another program: C:\raul\sonarqube-10.4.0.87286\data\es8\node.lock
	at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:117) ~[lucene-core-9.8.0.jar:?]
	at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:43) ~[lucene-core-9.8.0.jar:?]
	at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:44) ~[lucene-core-9.8.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:232) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:206) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:286) ~[elasticsearch-8.11.0.jar:?]
	... 5 more

Can someone help me?

Hi Raul,

I had the same issue. Apparently you need jdk-17 for SonarQube. See also here:

Chris

1 Like