4

I got such an error. Is it related to dependencies? How can this be fixed?

java.lang.IllegalArgumentException: Property 'http://javax.xml.XMLConstants/property/accessExternalSchema' is not recognized.
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(Unknown Source) ~[xercesImpl-2.12.1.jar:na]
at org.apache.poi.util.XMLHelper.trySet(XMLHelper.java:284) ~[poi-5.1.0.jar:5.1.0]
at org.apache.poi.util.XMLHelper.getDocumentBuilderFactory(XMLHelper.java:114) ~[poi-5.1.0.jar:5.1.0]
at org.apache.poi.util.XMLHelper.<clinit>(XMLHelper.java:85) ~[poi-5.1.0.jar:5.1.0]
at org.apache.poi.ooxml.util.DocumentHelper.newDocumentBuilder(DocumentHelper.java:47) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.ooxml.util.DocumentHelper.<clinit>(DocumentHelper.java:36) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:393) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:102) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:53) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:282) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:740) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:315) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:47) ~[poi-ooxml-5.1.0.jar:5.1.0]
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:296) ~[poi-ooxml-5.1.0.jar:5.1
Dev007
  • 366
  • 1
  • 12
  • 2
    this is logging - it doesn't stop POI working - using the JDK parser (and removing xerces jar from your classpath) should lead to the logging going away - or you can configure your logging framework to ignore these logs – PJ Fanning Dec 10 '21 at 09:23
  • 1
    This does not make the POI stop, but it looks ugly :) – Dev007 Dec 10 '21 at 11:13

1 Answers1

1

The provided implementation of the DocumentBuilderFactory doesn't support the mentioned property.

It could be that some third-party dependency in your classpath provides its implementation or its the behavior of the default one from your JDK.

You can configure your program to use the implementation that supports or ignores the mentioned property.

I elaborated on the details in another similar answer.

Ed Gomoliako
  • 991
  • 1
  • 8
  • 18