sonarqube:错误:无法创建java虚拟机

cyvaqqii  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(2068)

我是sonarqube的新手,当我运行“c:\sonarqube-8.5.1.38104\bin\windows-x86-64\startsonar.bat”时,我收到以下错误,
--> Package 器作为控制台启动

Launching a JVM...
Picked up _JAVA_OPTIONS: -Xmx1024M
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2020.11.16 13:40:45 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\sonarqube-8.5.1.38104\temp
2020.11.16 13:40:45 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.11.16 13:40:45 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [C:\sonarqube-8.5.1.38104\elasticsearch]: C:\Program Files\Java\jdk-15.0.1\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -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 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=C:\sonarqube-8.5.1.38104\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\sonarqube-8.5.1.38104\elasticsearch -Des.path.conf=C:\sonarqube-8.5.1.38104\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2020.11.16 13:40:45 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Picked up _JAVA_OPTIONS: -Xmx1024M
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
2020.11.16 13:40:46 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2020.11.16 13:40:46 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.11.16 13:40:46 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
FATAL StatusLogger Interrupted before Log4j Providers could be loaded.
 java.lang.InterruptedException
    at java.base/java.util.concurrent.locks.ReentrantLock$Sync.lockInterruptibly(ReentrantLock.java:159)
    at java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:372)
    at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:121)
    at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:108)
    at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89)
    at org.elasticsearch.common.unit.ByteSizeValue.<clinit>(ByteSizeValue.java:39)
    at org.elasticsearch.common.network.NetworkService.<clinit>(NetworkService.java:57)
    at org.elasticsearch.transport.TransportSettings.<clinit>(TransportSettings.java:74)
    at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:105)
    at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:135)
    at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:277)
    at org.sonar.application.es.EsConnectorImpl$MinimalTransportClient.<init>(EsConnectorImpl.java:103)
    at org.sonar.application.es.EsConnectorImpl.buildTransportClient(EsConnectorImpl.java:89)
    at org.sonar.application.es.EsConnectorImpl.getTransportClient(EsConnectorImpl.java:74)
    at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:61)
    at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:88)
    at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:73)
    at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:58)
    at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:220)
    at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:285)
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

<-- Package 已停止
请帮帮我。。。提前谢谢。

pgpifvop

pgpifvop1#

您的问题很可能是由于您试图使用不受支持的java版本运行sonarqube造成的。
根据错误日志,我假定您正试图使用java 14或java 15运行它,基于以下行:

Picked up _JAVA_OPTIONS: -Xmx1024M
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

cms收集器在java 9中被弃用,在java 14中被完全删除:
https://openjdk.java.net/jeps/363
这意味着试图启动sonar的批处理脚本正在传入一些不再有效的jvm参数。
根据他们的文档,只支持java版本8和11
https://docs.sonarqube.org/latest/requirements/requirements/
不支持以上版本:
sonarqube扫描仪需要jvm的版本8或11,sonarqube服务器需要版本11。官方不支持Java11以外的版本。
我建议您尝试使用正确的java版本来运行它。也请事先检查相关文件,以避免此类问题。

相关问题