Sonarqube-10.0.0.68432 Community Edition and SQL Server

Hello,
I have downloaded this version and installed on my windows 2019 server.
sonarqube-10.0.0.68432. This works well on H2 database with warning.

image

Edition: Community
Official Distribution: Yes
Force authentication:Yes
Home Dir : D:\sonarqube\sonarqube-10.0.0.68432
Data Dir D:\sonarqube\sonarqube-10.0.0.68432\data
Temp Dir D:\sonarqube\sonarqube-10.0.0.68432\temp
Processors 4
Database Database H2
Database Version 2.1.214 (2022-06-13)

I have sql server
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) on same machine.
image

Some how it does not connect to sql server and does not leave any trace to troubleshoot. I used both combination for connection string.
Below are the values modified

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true;
This does not work.
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=false;
This does not work.
Commenting above line and below configuration does not work.
sonar.jdbc.url=jdbc:sqlserver://localhost:1433;databaseName=sonar ;

Having database created and deleted on server named sonar does not make any difference.
having this file in system 32 also does not make any difference

image

Can any one put some light on this issue ?

Hey there.

Where are you modifying the values, and have you performed a full restart of the SonarQube service each time you’ve changed the values?

Do you receive some connection failure, or does it simply always start against the H2 database?

Values are modified in config file of sonar named sonar.properties.

After changes in file, sonar does not start. nor leaves any error message.

Have you checked the logs for error message? Specifically web.log, since it concerns the database connection.

Web.log does not exist.

Only files generated are

image

and Below is ES log.

2023.05.22 10:22:26 INFO es[o.e.n.Node] version[8.6.1], pid[9772], build[tar/180c9830da956993e59e2cd70eb32b5e383ea42c/2023-01-24T21:35:11.506992272Z], OS[Windows Server 2019/10.0/amd64], JVM[Oracle Corporation/Java HotSpot™ 64-Bit Server VM/17.0.5/17.0.5+9-LTS-191]
2023.05.22 10:22:26 INFO es[o.e.n.Node] JVM home [D:\Program Files\Java\jdk-17.0.5], using bundled JDK [false]
2023.05.22 10:22: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=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=D:\sonarqube\sonarqube-10.0.0.68432\temp, -XX:ErrorFile=D:\sonarqube\sonarqube-10.0.0.68432\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=D:\sonarqube\sonarqube-10.0.0.68432\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, -Des.enforce.bootstrap.checks=true, -Xmx2g, -Xms1g, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=tar, --module-path=D:\sonarqube\sonarqube-10.0.0.68432\elasticsearch\lib, --add-modules=jdk.net, -Djdk.module.main=org.elasticsearch.server]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [aggregations]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [analysis-common]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [apm]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [lang-painless]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [old-lucene-versions]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [parent-join]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [reindex]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [transport-netty4]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [x-pack-aggregate-metric]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [x-pack-core]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] loaded module [x-pack-security]
2023.05.22 10:22:38 INFO es[o.e.p.PluginsService] no plugins loaded
2023.05.22 10:22:52 INFO es[o.e.e.NodeEnvironment] using [1] data paths, mounts [[Data (D:)]], net usable_space [83.5gb], net total_space [119.1gb], types [NTFS]
2023.05.22 10:22:52 INFO es[o.e.e.NodeEnvironment] heap size [2gb], compressed ordinary object pointers [true]
2023.05.22 10:22:53 INFO es[o.e.n.Node] node name [sonarqube], node ID [ymHRbZwlScOvXQ8iA8CA6w], cluster name [sonarqube], roles [data, data_cold, ingest, data_frozen, ml, data_hot, transform, data_content, data_warm, master, remote_cluster_client]
2023.05.22 10:23:02 INFO es[o.e.x.s.Security] Security is disabled
2023.05.22 10:23:03 INFO es[o.e.t.n.NettyAllocator] creating NettyAllocator with the following configs: [name=elasticsearch_configured, chunk_size=1mb, suggested_max_allocation_size=1mb, factors={es.unsafe.use_netty_default_chunk_and_page_size=false, g1gc_enabled=true, g1gc_region_size=4mb}]
2023.05.22 10:23:03 INFO es[o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2023.05.22 10:23:04 INFO es[o.e.d.DiscoveryModule] using discovery type [single-node] and seed hosts providers [settings]
2023.05.22 10:23:06 INFO es[o.e.n.Node] initialized
2023.05.22 10:23:06 INFO es[o.e.n.Node] starting …
2023.05.22 10:23:07 INFO es[o.e.t.TransportService] publish_address {127.0.0.1:54497}, bound_addresses {127.0.0.1:54497}
2023.05.22 10:23:09 INFO es[o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2023.05.22 10:23:09 INFO es[o.e.n.Node] stopping …
2023.05.22 10:23:09 INFO es[o.e.n.Node] stopped
2023.05.22 10:23:09 INFO es[o.e.n.Node] closing …
2023.05.22 10:23:09 INFO es[o.e.n.Node] closed

The issue appears to be right in the screenshot of logs you shared. The maximum/minimum heap size for your Elasticsearch process aren’t the same.

Do you have anything configured for sonar.search.javaOpts in your conf/sonar.properties file?

These are the values.

JVM options of Elasticsearch process

sonar.search.javaOpts=-Xmx2g -Xms1g -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError

Same as previous property, but allows to not repeat all other settings like -Xmx

#sonar.search.javaAdditionalOpts=

As noted in the log message, the min/max heap sizes should be equal:

sonar.search.javaOpts=-Xmx2g -Xms2g

Thanks for you help. Finally it worked with following changes.

sonar.jdbc.url=jdbc:sqlserver://ZZZZ-ZZZZ;databaseName=sonar; encrypt=true;trustServerCertificate=true;

I am trying to scan java Android code. now server responding random errors. Some time its works and some time it does not work. can any one help me to understand the issue ?

Error creating bean with name ‘org.sonarsource.scanner.api.internal.IsolatedClassloader@6b66534a-org.sonar.scanner.report.ReportPublisher’: Unsatisfied dependency expressed through constructor parameter 7; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.sonarsource.scanner.api.internal.IsolatedClassloader@6b66534a-org.sonar.scanner.report.ActiveRulesPublisher’: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ActiveRules’ defined in org.sonar.scanner.rule.ActiveRulesProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.api.batch.rule.internal.DefaultActiveRules]: Factory method ‘provide’ threw exception; nested exception is java.lang.IllegalStateException:

Fail to request url: http://10.0.0.212:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AYhEtkJ-KbPFOk-Fv97_&ps=500&p=1

Regards
Kp

I suggest raising a new thread. We try and stick to one topic per thread.