NoSuchMethodException:springframework.boot.

我想在Spring中使用Java 9。但我得到例外:


Caused by: org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.NoSuchMethodException: org.springframework.boot.autoconfigure.http.HttpMessageConverters$$EnhancerBySpringCGLIB$$1d90bff9.<init>()

    at deployment.datalis_gateway.war//org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:82)

    at deployment.datalis_gateway.war//org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:205)

    ... 62 more

Caused by: java.lang.NoSuchMethodException: org.springframework.boot.autoconfigure.http.HttpMessageConverters$$EnhancerBySpringCGLIB$$1d90bff9.<init>()

    at java.base/java.lang.Class.getConstructor0(Class.java:3302)

    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2512)

    at deployment.datalis_gateway.war//org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:76)

    ... 63 more

您知道如何配置Java 9来查找此受限制的Java程序包吗?


当年话下
浏览 112回答 3
3回答

catspeake

就我而言,VM的论点--add-modules=jdk.unsupported有所帮助。在这种情况下,ObjenesisCglibAopProxy将使用创建代理sun.reflect.ReflectionFactory,而不查找缺少的构造函数。

皈依舞

如果将jdk.unsupported添加为全局模块,则无需更改应用程序:<global-modules> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<module&nbsp;name="jdk.unsupported"/>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java