【问题标题】:WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2警告:请考虑将此报告给 com.google.inject.internal.cglib.core.$ReflectUtils$2 的维护者
【发布时间】:2020-12-04 23:52:27
【问题描述】:

我在使用 java 11 在 Tomcat 9 服务器上运行我的 webapp 时收到一条警告消息。

错误如下:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/C:/Users/<myuser>/Documents/Workspace2019-09/.metadata/.plugins/org.eclipse.wst.server.core/tmp8/wtpwebapps/myproject/WEB-INF/lib/guice-3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

我用谷歌搜索了这个特定的错误,发现将以下内容添加到 VM 参数将解决警告。

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

是否有解决此类错误的替代方法?有人建议使用以下方法对其进行调试。谁负责维护 com.google.inject.internal.cglib.core? guice 3.0 多久不支持?

--illegal-access=deny

警告本身说要使用以下内容:

--illegal-access=warn

这是我的图书馆:

【问题讨论】:

标签: java maven guice tomcat9


【解决方案1】:

这是一个已知的错误。它正在 Guice 的第 5 版中得到修复,该版本即将发布(可能)。只需等待版本 5 发布,然后进行升级。我当前基于 master 分支构建的 Guice 不再存在此问题。

如果您不惧怕测试版,您可以使用Guice 5.0.0-BETA-1,它可以解决除辅助注射之外的所有问题。完整的修复程序已经准备好,但尚未发布带有该修复程序的用于辅助注入的新 beta 版本。

【讨论】:

    【解决方案2】:

    有问题的项目是Google Guice。 (你没有发布足够的信息让我知道是什么版本。)

    你可以通过询问Maven Central to tell you what project a class is part of来解决这个问题。

    【讨论】:

    • 项目中使用的版本是guice-3.0.jar。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-04
    • 2011-08-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 2021-12-26
    • 2012-05-19
    相关资源
    最近更新 更多