sonarqube JDK17启动失败

0

错误日志:

wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | 2021.09.16 13:26:54 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\develop\sonarqube-9.0.1.46107\temp
jvm 1    | 2021.09.16 13:26:55 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:1025]
jvm 1    | 2021.09.16 13:26:55 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [D:\develop\sonarqube-9.0.1.46107\elasticsearch]: D:\Program Files\Java\jdk-17\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.io.tmpdir=D:\develop\sonarqube-9.0.1.46107\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -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 -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 -Djava.locale.providers=COMPAT -Des.enforce.bootstrap.checks=true -Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=D:\develop\sonarqube-9.0.1.46107\elasticsearch -Des.path.conf=D:\develop\sonarqube-9.0.1.46107\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
jvm 1    | 2021.09.16 13:26:55 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1    | Unrecognized VM option 'UseConcMarkSweepGC'
jvm 1    | Error: Could not create the Java Virtual Machine.
jvm 1    | Error: A fatal exception has occurred. Program will exit.
jvm 1    | 2021.09.16 13:26:55 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
jvm 1    | 2021.09.16 13:26:55 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
jvm 1    | 2021.09.16 13:26:55 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
jvm 1    | 2021.09.16 13:26:56 ERROR app[][o.s.a.p.EsManagedProcess] Failed to check status
jvm 1    | java.lang.RuntimeException: thread waiting for the response was interrupted
jvm 1    |      at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:849)
jvm 1    |      at org.elasticsearch.client.RestClient.performRequest(RestClient.java:283)
jvm 1    |      at org.elasticsearch.client.RestClient.performRequest(RestClient.java:270)
jvm 1    |      at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1654)
jvm 1    |      at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1624)
jvm 1    |      at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1594)
jvm 1    |      at org.elasticsearch.client.ClusterClient.health(ClusterClient.java:119)
jvm 1    |      at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:64)
jvm 1    |      at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:89)
jvm 1    |      at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:74)
jvm 1    |      at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:59)
jvm 1    |      at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:220)
jvm 1    |      at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:285)
jvm 1    | Caused by: java.lang.InterruptedException: null
jvm 1    |      at java.base/java.lang.Object.wait(Native Method)
jvm 1    |      at java.base/java.lang.Object.wait(Object.java:338)
jvm 1    |      at org.apache.http.concurrent.BasicFuture.get(BasicFuture.java:82)
jvm 1    |      at org.apache.http.impl.nio.client.FutureWrapper.get(FutureWrapper.java:70)
jvm 1    |      at org.elasticsearch.client.RestClient.performRequest(RestClient.java:279)
jvm 1    |      ... 11 common frames omitted
wrapper  | <-- Wrapper Stopped

修改垃圾回收,应该是JDK17不支持CMS垃圾回收了。
需要修改配置sonar.properties

sonar.search.javaOpts=-Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:+IgnoreUnrecognizedVMOptions

修改elasticsearch配置jvm.options没有任何效果。