【问题标题】:Issue with Sonar installation : Unrecognized VM option '+HeapDumpOnOutOfMemoryError'声纳安装问题:无法识别的 VM 选项“+HeapDumpOnOutOfMemoryError”
【发布时间】:2014-03-14 15:48:58
【问题描述】:

我正在尝试安装 Sonar 以获取我的项目的一些统计信息,但我收到此错误:

 --> Wrapper Started as Console
    Launching a JVM...
    Unrecognized VM option '+HeapDumpOnOutOfMemoryError'
    Could not create the Java virtual machine.
    JVM exited while loading the application.
    Launching a JVM...
    Unrecognized VM option '+HeapDumpOnOutOfMemoryError'
    Could not create the Java virtual machine.
    JVM exited while loading the application.
    Launching a JVM...
    Unrecognized VM option '+HeapDumpOnOutOfMemoryError'
    Could not create the Java virtual machine.
    JVM exited while loading the application.
    Launching a JVM...
    Unrecognized VM option '+HeapDumpOnOutOfMemoryError'
    Could not create the Java virtual machine.
    JVM exited while loading the application.
    Launching a JVM...
    Unrecognized VM option '+HeapDumpOnOutOfMemoryError'
    Could not create the Java virtual machine.
    JVM exited while loading the application.
    There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
      There may be a configuration problem: please check the logs.
    <-- Wrapper Stopped

我用来启动 Sonar 的脚本是 StartSonar:

 @echo off setlocal

rem Copyright (c) 1999, 2006 Tanuki Software Inc. rem rem Java Service Wrapper general startup script rem

rem rem Resolve the real path of the wrapper.exe rem  For non NT systems, the _REALPATH and _WRAPPER_CONF values rem  can be hard-coded below and the following test removed. rem if "%OS%"=="Windows_NT" goto nt echo This script only works with NT-based versions of Windows. goto :eof

:nt rem rem Find the application home. rem rem %~dp0 is location of current script under NT set _REALPATH=%~dp0

rem Decide on the wrapper binary. set _WRAPPER_BASE=wrapper set
_WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe if exist "%_WRAPPER_EXE%" goto conf set
_WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe if exist "%_WRAPPER_EXE%" goto conf set
_WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe if exist "%_WRAPPER_EXE%" goto conf echo Unable to locate a Wrapper executable using any of the following names: echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe echo %_REALPATH%%_WRAPPER_BASE%.exe pause goto :eof

rem rem Find the wrapper.conf rem :conf set _WRAPPER_CONF="%~f1" if not %_WRAPPER_CONF%=="" goto startup set
_WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"

rem rem Start the Wrapper rem :startup "%_WRAPPER_EXE%" -c %_WRAPPER_CONF% if not errorlevel 1 goto :eof pause

为什么会发生这种情况,我该如何解决?

【问题讨论】:

  • 能否请您发布您用于启动声纳的脚本?
  • @Jorge_B :我已经编辑了我的问题 :)
  • 你确定是JVM吗?这 - 真的 - 看起来您使用的是旧版本。您可以从启动 Sonar 的相同情况/用户中输出 java -version 吗?

标签: java sonarqube sonar-runner


【解决方案1】:

这似乎不太可能,但似乎 JVM 的 HeapDumpOnOutOfMemoryError 参数是在 JDK 1.4.2 - 更新 12 中引入的

您使用的不是旧版本的 Java?

【讨论】:

  • 那么您将不得不额外确保您的脚本正在加载正确的版本。如果可能,请在您的机器上删除对旧 JDK 的任何引用(我知道 Windows 对注册表做了一些令人讨厌的技巧,让您相信您正在使用一个版本但加载了另一个版本)。
  • 你说得对,我以为我使用的是 jre7,但是当我在 cmd 中编写 java -version 时,结果发现 Windows 使用的是旧版本的 Java :)
【解决方案2】:

问题的根源在 ..\conf\wrapper.conf 文件中。

在注释中加入一行:

  • wrapper.java.additional.3=-XX:+HeapDumpOnOutOfMemoryError

并尝试启动 SonarQube。

【讨论】:

  • 我现在遇到这个错误:WrapperSimpleApp:无法找到类 org.sonar.application.StartServer:java.lang.UnsupportedClassVersionError:org/sonar/application/StartServer(不支持的 major.minor 版本50.0)
  • 需要 Java 6 或更高版本。不支持 Java 5。
【解决方案3】:

检查声纳日志文件本身。您可以在“sonarqube-4.5\logs”目录下的 sonar.log 文件中找到服务器启动日志。

您会发现由于以下端口绑定异常,服务器没有启动:

2015.12.01 02:46:36 ERROR web[o.a.c.h.Http11Protocol]  Failed to initialize end point associated with ProtocolHandler ["http-bio-0.0.0.0-9000"]
java.net.BindException: Address already in use: JVM_Bind /0.0.0.0:9000
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:411) ~[tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:640) ~[tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434) ~[tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119) [tomcat-embed-core-7.0.54.jar:7.0.54]

在“sonarqube-4.5\conf”目录下的 sonar.properties 文件中将端口号从“9000”更改为“4950”。

# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=4950

# TCP port for incoming HTTPS connections. Disabled when value is -1 (default).
#sonar.web.https.port=-1

【讨论】:

    猜你喜欢
    • 2011-06-15
    • 2020-10-24
    • 1970-01-01
    • 2020-04-29
    • 2016-08-26
    • 1970-01-01
    • 1970-01-01
    • 2016-05-27
    • 1970-01-01
    相关资源
    最近更新 更多