IDEA启动SpringBoot报错module java.base does not "opens java.lang.invoke" to unnamed module @4d910fd6

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field static final java.lang.invoke.MethodHandles$Lookup java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module java.base does not "opens java.lang.invoke" to unnamed module @4d910fd6
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at feign.DefaultMethodHandler.<init>(DefaultMethodHandler.java:41)
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:57)
at feign.Feign$Builder.target(Feign.java:269)
at org.springframework.cloud.openfeign.HystrixTargeter.target(HystrixTargeter.java:38)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:369)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:327)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169)
... 57 common frames omitted

如果你是JDK17的用户,Edit Configuration

 

 

添加启动参数,注意标红的就是你报错的位置,如果你是java.util,那么这个位置就要填写java.util

--add-opens java.base/java.lang.invoke=ALL-UNNAMED

如果你有多个,空格分割即可
--add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED
posted @ 2023-05-30 16:15  露娜妹  阅读(541)  评论(0编辑  收藏  举报