- Code: Select all
org.docx4j.openpackaging.exceptions.Docx4JException: Cannot find external method 'org.docx4j.utils.XSLTUtils.logWarn' (must be public).
at org.docx4j.openpackaging.parts.JaxbXmlPart.getContents(JaxbXmlPart.java:180)
at com.fishbowl.cscomponent.docautomation.MetaDataParser.getWorksheetByName(MetaDataParser.java:526)
at com.fishbowl.cscomponent.docautomation.MetaDataParser.parseForCell(MetaDataParser.java:435)
at com.fishbowl.cscomponent.docautomation.MetaDataParser.parseNative(MetaDataParser.java:174)
... 92 more
Caused by: javax.xml.bind.JAXBException: Cannot find external method 'org.docx4j.utils.XSLTUtils.logWarn' (must be public).
- with linked exception:
[javax.xml.transform.TransformerConfigurationException: Cannot find external method 'org.docx4j.utils.XSLTUtils.logWarn' (must be public).]
at org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware.unmarshal(JaxbXmlPartXPathAware.java:586)
at org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware.unmarshal(JaxbXmlPartXPathAware.java:346)
at org.docx4j.openpackaging.parts.JaxbXmlPart.getContents(JaxbXmlPart.java:176)
... 95 more
Caused by: javax.xml.transform.TransformerConfigurationException: Cannot find external method 'org.docx4j.utils.XSLTUtils.logWarn' (must be public).
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:1020)
at weblogic.xml.jaxp.WebLogicTransformerFactory.newTemplates(WebLogicTransformerFactory.java:194)
at weblogic.xml.jaxp.RegistryTransformerFactory.newTemplates(RegistryTransformerFactory.java:173)
at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:1202)
at org.docx4j.jaxb.JaxbValidationEventHandler.getMcPreprocessor(JaxbValidationEventHandler.java:63)
at org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware.unmarshal(JaxbXmlPartXPathAware.java:507)
... 97 more
Here is the relevant source code of my component (though this error happens in multiple places):
- Code: Select all
525 private static Worksheet getWorksheetByName(WorkbookPart workbook, String sheet) throws Docx4JException, Xlsx4jException{
526 List<Sheet> sheets = workbook.getContents().getSheets().getSheet();
527 for(int i = 0; i < sheets.size(); i++){
528 if(sheets.get(i).getName().equals(sheet)){
529 return workbook.getWorksheet(i).getContents();
530 }
531 }
532 return null;
533 }
As you can see by this example, the error occurs anytime I try to get the contents of a workbook when parsing an Excel spreadsheet. I'm fairly certain there's nothing special in the test spreadsheet I'm using. Regarding Word documents, I have observed that my code works as intended in most standard cases, but if the document has a drawing (like a shape - images work fine) I get the same error.
The version of WebLogic I am using has EclipseLink 2.6. I have tried adding the optional MOXy libraries to the classpath. I have also tried inserting the following code, to no avail:
- Code: Select all
Docx4jProperties.setProperty("javax.xml.parsers.SAXParserFactory", "weblogic.xml.jaxp.WebLogicSAXParserFactory");
Docx4jProperties.setProperty("docx4j.javax.xml.parsers.SAXParserFactory.donotset", true);
Docx4jProperties.setProperty("javax.xml.parsers.DocumentBuilderFactory", "weblogic.xml.jaxp.WebLogicDocumentBuilderFactory");
Docx4jProperties.setProperty("docx4j.javax.xml.parsers.DocumentBuilderFactory.donotset", true);
One of the main issues with fixing this is due to the nature of the component I'm creating. This component should be able to be installed into other instances of WebCenter Content with little to no extra effort. What that means is, ideally I would like to find a way to solve this problem that doesn't involve changing the server's configurations. Anything that can be done through Java code is fine, but I'd like to avoid making changes to any external configuration files or server configurations. That said, if that is the only way to solve this problem, then it may be unavoidable. Though I have tried changing the classes for the SAX Parser Factory and Transformer Factory through the XML Registries section of the WebLogic Server admin console, and it didn't seem to change anything.
Any ideas on what could be causing this issue?