0

I'm working on Apache POI ppt project and getting this exception but not able to figure out what's wrong here?

10:46:45.903 [main] DEBUG org.apache.poi.openxml4j.opc.ZipPackage - Save content types part
10:46:45.927 [main] WARN org.apache.poi.util.XMLHelper - SAX Feature unsupported [log suppressed for 5 minutes]http://javax.xml.XMLConstants/property/accessExternalDTD
java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
    at org.docx4j.org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571)
    at org.apache.poi.util.XMLHelper.trySet(XMLHelper.java:284)
    at org.apache.poi.util.XMLHelper.getTransformerFactory(XMLHelper.java:224)
    at org.apache.poi.util.XMLHelper.newTransformer(XMLHelper.java:231)
    at org.apache.poi.openxml4j.opc.StreamHelper.saveXmlInStream(StreamHelper.java:56)
    at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.saveImpl(ZipContentTypeManager.java:68)
    at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.save(ContentTypeManager.java:450)
    at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:554)
    at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1487)
    at org.apache.poi.ooxml.POIXMLDocument.write(POIXMLDocument.java:227)
    at com.iep.generator.PptCreater.createPpt(PptCreater.java:526)
    at com.iep.generator.PptCreater.main(PptCreater.java:94)
10:46:45.970 [main] DEBUG org.apache.poi.openxml4j.opc.ZipPackage - Save package relationships

Note : My code is working fine, even with this exception.

  • 1
    Does this answer your question? [How to disable accessExternalDTD and entityExpansionLimit warnings with logback](https://stackoverflow.com/questions/25453042/how-to-disable-accessexternaldtd-and-entityexpansionlimit-warnings-with-logback) – cyberbrain Sep 06 '22 at 05:39
  • Install a non-broken XML parser, or otherwise live with the warnings about the security hardening that won't work? – Gagravarr Sep 06 '22 at 07:07
  • using Jsoup. @Gagravarr – Code Machine Sep 06 '22 at 07:11
  • Not using xerces jar anywhere in my project @cyberbrain – Code Machine Sep 06 '22 at 07:13
  • Did you check your transitive dependencies as well? – cyberbrain Sep 06 '22 at 08:53
  • 4
    This is just a warning log message - it shouldn't stop POI working - that docx4j jar embeds a shaded xalan instance that is causing the issues - docx4j should stop doing that or embed a newer version of xalan – PJ Fanning Sep 06 '22 at 13:34
  • Yes, You are correct my code is working fine but can you suggest any way to get rid of it? @PJFanning – Code Machine Sep 07 '22 at 05:10

1 Answers1

0

I also faced same issue. I was able to solve this by using extension as .xls instead of .xlsx