WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.poi.util.DocumentHelper (file:/C:/Users/Administrator/.m2/repository/org/apache/poi/poi-ooxml/3.17/poi-ooxml-3.17.jar) to constructor com.sun.org.apache.xerces.internal.util.SecurityManager() 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 怎么去掉 这警告
时间: 2024-04-11 17:32:33 浏览: 593
这个警告是因为在运行时访问了不应该公开访问的类。由于警告是由Apache POI库引起的,可以尝试通过设置Java系统属性来解决这个问题。在程序的启动代码中,添加以下代码:
```java
System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.NullLogger");
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
```
这将禁用Apache POI库的日志记录,从而消除警告。请确保在执行任何与Apache POI相关的操作之前设置这些属性。
另外,也可以考虑更新Apache POI库的版本到较新的版本,以查看是否有解决这个问题的修复。
请注意,这些警告仅仅是警告,对程序运行没有实际影响,可以忽略它们。但如果你希望消除警告,可以尝试上述方法。
相关问题
WARNING: An illegal reflective access operation has occurred
This warning message indicates that the Java code is using a feature that is not officially supported or recommended by the Java development team. This can be caused by using an outdated or deprecated API, or by using a third-party library that is not compliant with the latest Java standards.
While this warning message does not necessarily mean that the code is broken or will not function, it is a good idea to investigate why the code is generating this warning and see if there is a more compliant way to achieve the same functionality. Ignoring this warning could result in compatibility issues or security vulnerabilities in the future.
warning: an illegal reflective access operation has occurred
这是一个由于 Java 程序运行时反射操作导致的错误。反射是 Java 程序中用于在运行时访问、操作类、接口、字段和方法的机制,但是反射操作也可能会导致安全问题。请检查程序代码是否正确使用了反射操作。
阅读全文
相关推荐
















