I'm writing a custom component for Oracle WCC to read in and process metadata updates from an Excel file.
However, when my Component tries to read the file with apache-poi (version: 3.11) I get the following exception:
!csUserEventMessage,weblogic,localhost:16200!$!csUnableToExecMethod,runTheMassUpdate!syJavaExceptionWrapper,java.lang.NoClassDefFoundError: org/xml/sax/EntityResolver
intradoc.common.ServiceException: !csUnableToExecMethod,runTheMassUpdate
*ScriptStack LOWES_MMU_SERVICE
3:runTheMassUpdate,**no captured values**
at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:2176)
at intradoc.server.Service.buildServiceException(Service.java:2404)
at intradoc.server.Service.createServiceExceptionEx(Service.java:2398)
at intradoc.server.Service.createServiceException(Service.java:2393)
at intradoc.server.Service.doCodeEx(Service.java:673)
at intradoc.server.Service.doCode(Service.java:594)
at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
at intradoc.server.Service.doAction(Service.java:566)
/* Lines removed for brevity */
Caused by: java.lang.NoClassDefFoundError: org/xml/sax/EntityResolver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at intradoc.loader.IdcClassLoader.defineClass(IdcClassLoader.java:639)
at intradoc.loader.IdcClassLoader.findClass(IdcClassLoader.java:794)
at intradoc.loader.IdcClassLoader.loadClass(IdcClassLoader.java:677)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at intradoc.loader.IdcClassLoader.defineClass(IdcClassLoader.java:639)
at intradoc.loader.IdcClassLoader.findClass(IdcClassLoader.java:794)
at intradoc.loader.IdcClassLoader.loadClass(IdcClassLoader.java:677)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.poi.util.SAXHelper.<clinit>(SAXHelper.java:53)
at org.apache.poi.util.DocumentHelper.newDocumentBuilder(DocumentHelper.java:45)
at org.apache.poi.util.DocumentHelper.<clinit>(DocumentHelper.java:100)
at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:376)
at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:102)
at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:54)
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:192)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:673)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:226)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:186)
at com.lowes.content.edam.massMetaDataUpdate.file.impl.ExcelFileParser.readInputFile(ExcelFileParser.java:162)
I've added the library files to my components classpath in the hda file.
classpath=$COMPONENT_DIR/classes/:$COMPONENT_DIR/lib/poi-ooxml-3.11.jar:$COMPONENT_DIR/lib/stax-api-1.0.1.jar:$COMPONENT_DIR/lib/xmlbeans-2.3.0.jar:$COMPONENT_DIR/lib/httpcore-4.4.1.jar:$COMPONENT_DIR/lib/jna-4.1.0.jar:$COMPONENT_DIR/lib/guava-11.0.jar:$COMPONENT_DIR/lib/httpmime-4.4.1.jar:$COMPONENT_DIR/lib/javax.servlet-api-3.1.0.jar:$COMPONENT_DIR/lib/xml-apis-1.0.b2.jar:$COMPONENT_DIR/lib/poi-3.11.jar:$COMPONENT_DIR/lib/dom4j-1.6.1.jar:$COMPONENT_DIR/lib/owasp-java-html-sanitizer-1.1.jar:$COMPONENT_DIR/lib/ooxml-schemas-1.1.jar:$COMPONENT_DIR/lib/poi-ooxml-schemas-3.11.jar:$COMPONENT_DIR/lib/jsr173-1.0.jar:$COMPONENT_DIR/lib/jna-platform-4.1.0.jar:$COMPONENT_DIR/lib/httpclient-4.4.1.jar:$COMPONENT_DIR/lib/jsr305-2.0.1.jar
classpathorder=0
libpath=$COMPONENT_DIR/lib
libpathorder=0
Note: the missing class should be being provided by xml-apis-1.0.b2.jar
which is a maven dependency, and included in the component Classpath, and copied into the lib folder.
So why am I getting the exception?
Why Can't the server find org.xml.sax.EntityResolver
?
further question
I hope I'm not sending this down the wrong rabbit hole but a former co-worker ran into an issue with the oracle-ucm IdcClassLoader
when using apache-fop. Since fop uses it's own custom classloader. Does apache-poi have the same issue?
Manifest.hda (component listing)
component
LowesMassMetadataUpdater/LowesMassMetadataUpdater.hda
componentExtra
LowesMassMetadataUpdater/readme.md
componentClasses
LowesMassMetadataUpdater/classes/
componentLib
LowesMassMetadataUpdater/lib/
Check your manifest.hda and make sure the 'Component Name'/libs is added as a componentExtra or componentLib otherwise those libs libraries won't be deployed to the content server's filesystem on component install (and hence the classes won't be resolved at runtime). You can check this assumption if you peer into the filesystem of the user_project's WCC instance in question.
The classloader probably has classes from one SAX implementation already loaded. Try removing the xml-apis-1.0.b2.jar from your classpath completely. I'd wager there's already a competing SAX implementation in the classpath that is compatible.