运行环境为jdk17、21时报错 #5242
Unanswered
codenotknock
asked this question in
Q&A
Replies: 2 comments 2 replies
-
could you please share some error? |
Beta Was this translation helpful? Give feedback.
2 replies
-
apollo 从 2.0.0 版本开始支持 java 17 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
springboot项目为2.2.5.RELEASE
apollo.version为1.5.1
我使用jdk8编译打包项目后在jdk17、21的运行环境上运行时报错了
请问有什么好的解决方法吗,期望使用jdk8编译打包项目后能够在jdk17、21的运行环境上正常运行
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : com.xiaofu.autoconfigure.apollo.CommonApolloApplicationContextInitializer
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:445)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:427)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:420)
at org.springframework.boot.SpringApplication.(SpringApplication.java:272)
at org.springframework.boot.SpringApplication.(SpringApplication.java:253)
at org.springframework.boot.builder.SpringApplicationBuilder.createSpringApplication(SpringApplicationBuilder.java:105)
at org.springframework.boot.builder.SpringApplicationBuilder.(SpringApplicationBuilder.java:93)
at com.xiaofu.LogisticsAbnormalConsumeApplication.main(LogisticsAbnormalConsumeApplication.java:25)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
... 5 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xiaofu.common.autoconfigure.apollo.CommonApolloApplicationContextInitializer]: Constructor threw exception; nested exception is com.ctrip.framework.apollo.exceptions.ApolloConfigException: Unable to load instance for com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory!
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:216)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:441)
... 13 more
Caused by: com.ctrip.framework.apollo.exceptions.ApolloConfigException: Unable to load instance for com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory!
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInstance(SpringInjector.java:40)
at com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer.(ApolloApplicationContextInitializer.java:66)
at com.xiaofu.common.autoconfigure.apollo.CommonApolloApplicationContextInitializer.(CommonApolloApplicationContextInitializer.java:33)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:203)
... 14 more
Caused by: com.ctrip.framework.apollo.exceptions.ApolloConfigException: Unable to initialize Apollo Spring Injector!
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInjector(SpringInjector.java:24)
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInstance(SpringInjector.java:37)
... 20 more
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.ExceptionInInitializerError
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
at com.google.common.cache.LocalCache.get(LocalCache.java:3953)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3976)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4960)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4966)
at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:138)
at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:536)
at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:160)
at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:123)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
at com.google.inject.Guice.createInjector(Guice.java:99)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInjector(SpringInjector.java:22)
... 21 more
Caused by: java.lang.ExceptionInInitializerError
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.getProtectionDomain(FastClass.java:73)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:206)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:252)
at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:203)
at com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:53)
at com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:158)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:90)
at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
... 37 more
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 @1a968a59
at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:203)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:197)
at com.google.inject.internal.cglib.core.$ReflectUtils$1.run(ReflectUtils.java:52)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
at com.google.inject.internal.cglib.core.$ReflectUtils.(ReflectUtils.java:42)
... 53 more
Beta Was this translation helpful? Give feedback.
All reactions