alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.3k stars 12.84k forks source link

JDK 16 启动 Nacos2 提示 ClassNotFoundException #6774

Closed wolf8334 closed 3 years ago

wolf8334 commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

When start Nacos2 with JDK16 by the shell script startup.sh,It says 'ClassNotFoundException'。

Expected behavior A clear and concise description of what you expected to happen. Nacos2 Server starts without no errors.

Acutally behavior A clear and concise description of what you actually to happen. I found the 'ClassNotFoundException' in the start.out and the system does not boot up.

How to Reproduce Steps to reproduce the behavior:

  1. install openjdk16 with yum command
  2. configure the java_home parameter like this. export JAVA_HOME=/usr/lib/jvm/java-16-openjdk-16.0.1.0.9-3.rolling.el7.x86_64 PATH=$PATH:$JAVA_HOME/bin
  3. download and untar the archive.goes into the directory bin and type ./startup.sh
  4. the screen says /usr/lib/jvm/java-16-openjdk-16.0.1.0.9-3.rolling.el7.x86_64/bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/SpringCloud/Alibaba/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Dnacos.member.list= -Xlog:gc*:file=/opt/SpringCloud/Alibaba/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400 -Dloader.path=/opt/SpringCloud/Alibaba/nacos/plugins/health,/opt/SpringCloud/Alibaba/nacos/plugins/cmdb -Dnacos.home=/opt/SpringCloud/Alibaba/nacos -jar /opt/SpringCloud/Alibaba/nacos/target/nacos-server.jar --spring.config.additional-location=file:/opt/SpringCloud/Alibaba/nacos/conf/ --logging.config=/opt/SpringCloud/Alibaba/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos is starting with cluster nacos is starting,you can check the /opt/SpringCloud/Alibaba/nacos/logs/start.out
  5. But I can not find nacos when I use command ps aux | grep java
  6. I find the lines below in start.out.Error: Could not find or load main class Caused by: java.lang.ClassNotFoundException:

Desktop (please complete the following information):

Additional context Add any other context about the problem here. When I try to start it directly from the command line with the command copied from the log above,it works.I just omit the string '/usr/lib/jvm/java-16-openjdk-16.0.1.0.9-3.rolling.el7.x86_64/bin/'.Yes,I copied the full command from 'java'

wolf8334 commented 3 years ago

I start the Nacos2 with the command below,It works java -server -Xms2g -Xmx2g -Xmn1g ......

brotherlu-xcq commented 3 years ago

Yes,It's a known issue in Nacos 2.0.3. duplicate with https://github.com/alibaba/nacos/issues/6609