2021年11月17日 | Leave a comment 问题: 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 @49b70bc7 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:60) at feign.Feign$Builder.target(Feign.java:251) at feign.Feign$Builder.target(Feign.java:247) 123456789 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 @49b70bc7 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:60) at feign.Feign$Builder.target(Feign.java:251) at feign.Feign$Builder.target(Feign.java:247) 解决: 启动时增加 --add-opens java.base/java.lang.invoke=ALL-UNNAMED 1 --add-opens java.base/java.lang.invoke=ALL-UNNAMED 参考: https://stackoverflow.com/questions/56274029/runing-jenkins-build-throws-java-lang-reflect-inaccessibleobjectexception