- versions: SonarQube Server / Community Build 9.9.0.65466, 10.5.1.90531, and 10.7.0.96327 all with Java 17 on Amazon Linux 2023 and Ubuntu 24.04.1 LTS
- how is SonarQube deployed: zip, on a 4GB RAM and 8GB SSD storage
- what are you trying to achieve: start sonarqube and run successfully
- what have you tried so far to achieve this:
After troubleshooting for a long time, I realised that whenever I uncommented and gave a value to either or all of these parameters: sonar.jdbc.username, sonar.jdbc.password, or sonar.jdbc.url, SonarQube fails to run. Below is the error:
23:48:29 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
23:48:29 DEBUG app[][o.s.a.NodeLifecycle] main tryToMoveTo from INIT to STARTING => true
23:48:29 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] main tryToMoveTo ElasticSearch from INIT to STARTING => true
23:48:29 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:46641]
23:48:30 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
23:48:30 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] main tryToMoveTo ElasticSearch from STARTING to STARTED => true
23:48:30 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
23:48:30 DEBUG app[][o.s.a.e.EsConnectorImpl] Connected to Elasticsearch node: [127.0.0.1:9001]
23:48:31 DEBUG app[][jdk.event.security] X509Certificate: Alg:SHA1withRSA, Serial:5ec3b7a6437fa4e0, Subject:C=ES, O=ACCV, OU=PKIACCV, CN=ACCVRAIZ1, Issuer:C=ES, O=ACCV, OU=PKIACCV, CN=ACCVRAIZ1, Key type:RSA, Length:4096, Cert Id:-592111236, Valid from:5/5/11, 9:37 AM, Valid until:12/31/30, 9:37 AM
...
23:48:37 DEBUG app[][jdk.event.security] X509Certificate: Alg:SHA256withRSA, Serial:43e37113d8b359145db7ce8cfd35fd6fbc058d45, Subject:CN=vTrus Root CA, O="iTrusChina Co.,Ltd.", O="iTrusChina Co.,Ltd.", C=CN, Key type:RSA, Length:4096, Cert Id:-1825883750, Valid from:7/31/18, 7:24 AM, Valid until:7/31/43, 7:24 AM
23:48:37 DEBUG app[][o.a.h.i.n.c.MainClientExec] [exchange: 1] start execution
23:48:37 DEBUG app[][o.a.h.c.p.RequestAddCookies] CookieSpec selected: default
23:48:37 DEBUG app[][j.io.serialization] Builtin factory: null -> new: null
23:48:37 DEBUG app[][o.a.h.c.p.RequestAuthCache] Re-using cached 'basic' auth scheme for http://127.0.0.1:9001
23:48:37 DEBUG app[][o.a.h.c.p.RequestAuthCache] No credentials for preemptive authentication
23:48:37 DEBUG app[][o.a.h.i.n.c.InternalHttpAsyncClient] [exchange: 1] Request connection for {}->http://127.0.0.1:9001
23:48:37 DEBUG app[][o.a.h.i.n.c.PoolingNHttpClientConnectionManager] Connection request: [route: {}->http://127.0.0.1:9001][total kept alive: 0; route allocated: 0 of 10; total>
23:48:37 DEBUG app[][o.a.h.i.n.c.PoolingNHttpClientConnectionManager] Connection request failed
java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:174)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:148)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:351)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.base/java.lang.Thread.run(Thread.java:840)
23:48:37 DEBUG app[][o.a.h.i.n.c.InternalHttpAsyncClient] [exchange: 1] connection request failed
23:48:37 DEBUG app[][o.e.c.RestClient] request [GET http://127.0.0.1:9001/] failed
java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:174)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:148)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:351)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.base/java.lang.Thread.run(Thread.java:840)
23:48:37 TRACE app[][tracer] curl -iX GET 'http://127.0.0.1:9001/'
23:48:37 DEBUG app[][o.e.c.RestClient] added [[host=http://127.0.0.1:9001]] to blacklist
Note:
- Database connection has been successfully tested from the server
- JDBC environment variables were also setup, but did not work still
- A dedicated sonar user was created to run sonarqube
- The sonarqube service is run via systemctl