項目場景:解決項目啟動Sentinel module java.base does not “opens java.lang“ to unnamed module問題
提示:這里簡述項目相關(guān)背景:
例如:服務(wù)器使用 java -jar xxx.jar 啟動項目,出現(xiàn)Sentinel module java.base does not “opens java.lang“ to unnamed module錯誤
問題描述
提示:這里描述項目中遇到的問題:
例如:服務(wù)器使用 java -jar xxx.jar 啟動項目,出現(xiàn)Sentinel module java.base does not “opens java.lang“ to unnamed module錯誤
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
原因分析:
提示:這里填寫問題的分析:
例如:關(guān)于解決JDK9非法反射訪問警告的,這種問題不會在JDK8出現(xiàn),也是模塊化的問題,因此解決方式類似,開放模塊即可。
解決方案:
需要添加如下兩個啟動參數(shù):文章來源:http://www.zghlxwxcb.cn/news/detail-601770.html
–add-opens java.base/java.lang=ALL-UNNAMED
–add-opens java.base/sun.net.util=ALL-UNNAMED。文章來源地址http://www.zghlxwxcb.cn/news/detail-601770.html
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED -jar XXXXX.jar
到了這里,關(guān)于解決Sentinel module java.base does not “opens java.lang“ to unnamed module問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!