Solve Sentinel module java.base does not "opens java.lang" problem

xcghvgshjdfghsd
中文

1 Environment

  • Sentinel 1.8.3
  • OpenJDK 17.0.2
  • Manjaro

2 Problem description

According to the official Github Wiki use the following command to start Sentinel :

java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar

The screenshot of the error is as follows:

在这里插入图片描述

The summary is as follows:

java.lang.IllegalStateException: Cannot load configuration class: com.alibaba.csp.sentinel.dashboard.DashboardApplication
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @74fdb593
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @74fdb593

You can see that the exception comes from InaccessibleObjectException , and the error message is module java.base does not "opens java.lang" to unnamed module @74fdb593 .

3 problem solving

In fact, the author wrote an article before about solving JDK9 illegal reflection access warning , this kind of problem will not appear in JDK8 , and it is also a modular problem, so the solution is similar, just open the module.

The following two startup parameters need to be added:

  • --add-opens java.base/java.lang=ALL-UNNAMED
  • --add-opens java.base/sun.net.util=ALL-UNNAMED

That's it, the complete command is as follows:

java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED -jar sentinel-dashboard-1.8.3.jar

Just change the port and the Sentinel version.

阅读 3.2k
339 声望
639 粉丝
0 条评论
339 声望
639 粉丝
文章目录
宣传栏