首页 > 编程语言 >Sentienl基于Jdk17版本运行出错:java.lang.IllegalStateException: Cannot load configuration class: com.alibaba.

Sentienl基于Jdk17版本运行出错:java.lang.IllegalStateException: Cannot load configuration class: com.alibaba.

时间:2023-09-25 19:13:42浏览次数:54  
标签:lang load java jar springframework alibaba 5.0 RELEASE org

java.lang.IllegalStateException: Cannot load configuration class: com.alibaba.csp.sentinel.dashboard.DashboardApplication
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:414) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at com.alibaba.csp.sentinel.dashboard.DashboardApplication.main(DashboardApplication.java:33) ~[classes!/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[sentinel-dashboard-1.8.1.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[sentinel-dashboard-1.8.1.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) ~[sentinel-dashboard-1.8.1.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) ~[sentinel-dashboard-1.8.1.jar:na]
Caused by: java.lang.ExceptionInInitializerError: null
        at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:122) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        ... 20 common frames omitted
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 @5dcaa742
        at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
        at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        ... 23 common frames omitted
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 @5dcaa742
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[na:na]
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) ~[na:na]
        at org.springframework.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) ~[na:na]
        at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329) ~[spring-core-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
        ... 35 common frames omitted

2023-09-25 18:54:23.322  INFO 12392 --- [           main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@51cdd8a: startup date [Mon Sep 25 18:54:22 CST 2023]; root of context hierarchy

解决方法
更改启动命令,打开特定的包装进行反射:
java --add-opens java.base/java.lang=ALL-UNNAMED -jar sentinel-dashboard-1.8.1.jar

注:我的电脑环境装的是jdk17,版本较高,由于 JDK 8 中有关反射相关的功能自从 JDK 9 开始就已经被限制了。
为了兼容原先的版本,需要在运行项目时添加 --add-opens java.base/java.lang=ALL-UNNAMED 选项来开启这种默认不被允许的行为。

标签:lang,load,java,jar,springframework,alibaba,5.0,RELEASE,org
From: https://www.cnblogs.com/xbf3910/p/17728642.html

相关文章

  • loader编写小记
    此项目在一些大佬的基础上进行了修改,或许能提供一些思路。还在学习中很菜很菜,不足之处还请师傅们多多指点......
  • Golang 的骚操作:go:linkname
    背景在看源码时,一些源码方法没有方法体,难道说明这些方法为空?例如:time.Now调用的now(),time.Sleep,reflect.makechan//Providedbypackageruntime.funcnow()(secint64,nsecint32,monoint64)funcSleep(dDuration)funcmakechan(typ*rtype,sizeint)(ch......
  • golang 1.18 workspace mode
    why?为什么需要workspace历史发展和版本依赖的管理GOPATH最开始的模式开发者需要设置一个环境变量GOPATH,用于指定项目的工作空间。GOPATH是一个目录路径,其中包括了三个重要的子目录:src、bin和pkg通过goget命令,GOPATH/src下的相应目录中缺点:必须指定GOPATH......
  • Anaconda-CondaError: Downloaded bytes did not match Content-Length
    遇到如下情况:CondaError:DownloadedbytesdidnotmatchContent-Length,换源!condaconfig--addchannelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/condaconfig--addchannelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/#设置搜索时显......
  • golang 的循环导入
    内容来自对chatgpt的咨询循环导入概念在Go语言中,循环导入是一个需要避免的问题。它发生在两个或更多的包彼此导入对方,形成一个导入循环,导致编译器无法处理。例如,假设你有两个包,包A和包B。包A导入了包B,然后包B又导入了包A,这就形成了一个循环导入。在这种情况下,编译器将无法......
  • springBoot结合springcloud alibaba
    版本对应很重要,很多问题都源于版本没有对应Q1:SpringCloud启动报错Didyouforgettoincludespring-cloud-starter-loadbalancerQ2:Nacos集群出现NacosException:Clientnotconnected,currentstatus:STARTINGQ3:配置中心不生效Q4:Errorcreatingbeanwithname‘configDataConte......
  • LangChain使用fine-tuned GPT-3.5
    LangChain使用fine-tunedGPT-3.5参考:https://openai.com/blog/gpt-3-5-turbo-fine-tuning-and-api-updateshttps://platform.openai.com/docs/guides/fine-tuninghttps://qiita.com/MandoNarin/items/6fadb78f357c66e25502事前准备!pipinstallopenai!pipinstalltiktok......
  • golang 怎么使用接口中声明的方法
    假设你有一个golang的interface,里面声明了1个函数,怎么调用这个函数typeManinterface{ Eat(ctxcontext.Context,foodstring})error}使用方式创建结构体实现这个接口声明的方法,然后创建该结构体对象,调用方法案例首先,我们需要创建一个实现了这个接口的结构体:type......
  • golang 使用redis设置分布式锁 demo
    内容来自对chatgpt的咨询分布式锁是在多个节点上运行的应用程序中协调工作的一种常用方法,而Redis是实现分布式锁的流行选择。以下是使用Go语言和github.com/go-redis/redis库来设置Redis分布式锁的一个简单示例:首先,确保你已经安装了该库:goget-ugithub.com/go-redis/redi......
  • golang 对字符串进行base64编解码、md5 编码
    内容来自对chagpt的咨询一、对字符串进行base64编解码base64编码要在Go语言中对字符串进行base64编码,你可以使用标准库中的encoding/base64包。以下是一个简单的示例:packagemainimport( "encoding/base64" "fmt")funcmain(){ data:="Hello,World!" enc......