【RocketMQ】启动NameServer和Broker报错Unrecognized VM option ‘UseConcMarkSweepGC‘

问题描述

启动RocketMQ NameServer和RocketMQ Broker报错。

mqnamesrv.cmd

Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
mqbroker.cmd

[0.004s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:C:\Users\xxx\mq_gc.log instead.
Unrecognized VM option 'PrintGCDateStamps'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

原因分析

当前JDK版本17.0.8。RocketMQ需运行在JDK8环境下。


解决方案

  1. 修改系统环境变量JAVA_HOME,指向JDK8路径。

  2. 为RocketMQ单独设置JDK路径:
    打开runserver.cmd,找到:

    set "JAVA=%JAVA_HOME%\bin\java.exe"
    

    %JAVA_HOME%替换为JDK8路径。

    打开runbroker.cmd,找到:

    set "JAVA=%JAVA_HOME%\bin\java.exe"
    

    %JAVA_HOME%替换为JDK8路径。

重新启动RocketMQ NameServer和Broker,成功启动。

mqnamesrv.cmd

Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success. serializeType=JSON, address 0.0.0.0:9876

参考资料

https://github.com/apache/rocketmq/issues/2395

你可能感兴趣的:(RocketMQ,rocketmq)