【问题标题】:An illegal reflective access operation has occurred Apache POIApache POI 发生了非法反射访问操作
【发布时间】:2018-04-28 01:31:33
【问题描述】:

我正在使用 Apache POI 处理 excel 文件,从 Java 9 开始,我收到了这条消息,根据这篇文章 JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState,我们应该等待开发人员解决这个问题,但我应该把它留在我的新生产版本?我认为如果我跳过警告应该没有问题。

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.util.DocumentHelper (file:/T:/Workspace/Java/Sections%20Manager/libs/poi/poi-ooxml-3.17.jar) to method com.sun.org.apache.xerces.internal.util.SecurityManager.setEntityExpansionLimit(int)
WARNING: Please consider reporting this to the maintainers of org.apache.poi.util.DocumentHelper
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

【问题讨论】:

标签: java apache-poi java-9


【解决方案1】:

添加更新的“poi-ooxml”依赖。它将解决上述所有警告。

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.0</version>
</dependency>

【讨论】:

  • 谢谢!更新的是4.1.2,它解决了我的问题。
【解决方案2】:

我遇到的错误是: 警告:发生了非法反射访问操作 警告:org.apache.poi.util.DocumentHelper(文件:/D:/Libary/poi-3.12/poi-ooxml-3.12-20150511.jar)对方法 com.sun.org.apache.xerces 的非法反射访问。 internal.util.SecurityManager.setEntityExpansionLimit(int) 警告:请考虑将此报告给 org.apache.poi.util.DocumentHelper 的维护者 警告:使用 --illegal-access=warn 启用对进一步非法反射访问操作的警告 警告:所有非法访问操作将在未来版本中被拒绝

请使用poi-3.6或更高版本,我使用poi-3

【讨论】:

  • 错误信息无需重复——和OP一样(只是文件路径不同)
  • 我正在使用 poi 3.8,但我仍然遇到此错误
猜你喜欢
  • 1970-01-01
  • 2018-02-24
  • 2021-08-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-22
  • 1970-01-01
  • 2021-01-10
相关资源
最近更新 更多