本文介绍了更新后的Apache POI 4.0-无法识别属性'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Apache POI从3.17更新到4.0.0之后,我上线了:

After updating Apache POI from 3.17 to 4.0.0 i'm getting on line:

OPCPackage pck = OPCPackage.open(this。 getTemplate());

例外:

java.lang.IllegalArgumentException: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
     at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:144)
     at __redirected.__DocumentBuilderFactory.setAttribute(__DocumentBuilderFactory.java:125)
     at org.apache.poi.ooxml.util.DocumentHelper.trySetXercesSecurityManager(DocumentHelper.java:143)
     at org.apache.poi.ooxml.util.DocumentHelper.<clinit>(DocumentHelper.java:108)
     at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:392)
     at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:104)
     at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:54)
     at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:258)
     at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:725)
     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:275)
     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:181)

他们在

the POI 4.0.0 code works with up to date versions of xerces - the code doesn't even get as far the trying to set the entity expansion limit because it will set the xerces security manager first and stop there - would you be able to try adding an explicit dependency on the latest version of xerces? https://mvnrepository.com/artifact/xerces/xercesImpl/2.12.0

这篇关于更新后的Apache POI 4.0-无法识别属性'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 14:28