最近新跟一个项目,项目拉下来之后运行一直报错,报错如下:
Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name ‘ipmsAuthenticationFilter’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ipmsClientDetailsService’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.inesa.ipms.api.admin.feign.client.ApiClient’: FactoryBean threw exception on object creation; nested exception is java.lang.reflect.InaccessibleObjectException: Unable to make field static final java.lang.invoke.MethodHandles
L
o
o
k
u
p
j
a
v
a
.
l
a
n
g
.
i
n
v
o
k
e
.
M
e
t
h
o
d
H
a
n
d
l
e
s
Lookup java.lang.invoke.MethodHandles
Lookupjava.lang.invoke.MethodHandlesLookup.IMPL_LOOKUP accessible: module java.base does not “opens java.lang.invoke” to unnamed module @15ff3e9e
在网上找原因一般大家推荐的都是在编辑器启动VM options里面加参数:
add-opens java.base/java.lang.invoke"=ALL-UNNAMED
但是我加了一直没有用,后来发现我用的是jdk18,但是项目必须用jdk11,换了jdk就行了。。。记录一下,希望以后不会再犯