apache/rocketmq

Rocketmq 4.8.0 Jdk8 Unrecognized option: -Xlog:gc*:file

SundyHu opened this issue · 4 comments

Under Ubuntu, jdk1.8.0_221 executes mqnamesrv error,
/bin/runserver.sh: 70: [[: not found
Unrecognized option: -Xlog:gc*:file=/dev/shm/rmq_srv_gc_%p_%t.log:time,tags:filecount=5,filesize=30M
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

download rocketmq4.8.0 from apache.

start broker and nameserver will get error.

system: macOS 11.2

run mqnameserv

 nohup sh bin/mqnamesrv &

get error

-Djava.ext.dirs=/Library/Java/JavaVirtualMachines/jdk-11.0.10.jdk/Contents/Home/jre/lib/ext:/usr/local/opt/rocketmq/bin/../lib:/Library/Java/JavaVirtualMachines/jdk-11.0.10.jdk/Contents/Home/lib/ext is not supported. 
Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

run broker

nohup sh bin/mqbroker -n localhost:9876 &

get error

[0.004s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/Volumes/RAMDisk/rmq_broker_gc_%p_%t.log instead.
Unrecognized VM option 'PrintGCDateStamps'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

问题是脚本: bin/runserver.sh 的问题,原生的/bin/sh不支持 if [[ "$JAVA_MAJOR_VERSION" -lt "9" ]] ; then 这个语法,[[,需要修改默认的shell,改成 /bin/bash,或者变更这个语法if [ "$JAVA_MAJOR_VERSION" -lt "9" ] ; then

问题是脚本: bin/runserver.sh 的问题,原生的/bin/sh不支持 if [[ "$JAVA_MAJOR_VERSION" -lt "9" ]] ; then 这个语法,[[,需要修改默认的shell,改成 /bin/bash,或者变更这个语法if [ "$JAVA_MAJOR_VERSION" -lt "9" ] ; then

好的,谢谢!已经解决了~

@SundyHu 怎么解决的?谢谢。