1

I am reading some xml files from an ibm queue and when updating to version 9 I started getting exception when trying to convert the xml to csv using the code below at the line (transformer.transform(source, outputTarget);

File stylesheet = new File("src/howto.xsl");
File xmlSource = new File("src/howto.xml");

DocumentBuilderFactory factory1 = DocumentBuilderFactory.newInstance();
DocumentBuilder builder1 = factory1.newDocumentBuilder();
Document document1 = builder1.parse(xmlSource);

StreamSource stylesource = new StreamSource(stylesheet);
Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesource);
Source source = new DOMSource(document);
Result outputTarget = new StreamResult(new File("/temp/howto.csv"));
                                transformer.transform(source, outputTarget);
                                System.out.println("Done.");

used same jdk and ibm libs from the queue server on the client

File stylesheet = new File("src/howto.xsl");
File xmlSource = new File("src/howto.xml");

DocumentBuilderFactory factory1 = DocumentBuilderFactory.newInstance();
DocumentBuilder builder1 = factory1.newDocumentBuilder();
Document document1 = builder1.parse(xmlSource);

StreamSource stylesource = new StreamSource(stylesheet);
Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesource);
Source source = new DOMSource(document);
Result outputTarget = new StreamResult(new File("/temp/howto.csv"));
                            transformer.transform(source, outputTarget);
                            System.out.println("Done.");

I am able to read the xml file and save it locally, but getting the below exception:

Could not initialize class com.sun.org.apache.xml.internal.serializer.EncodingsJul 10, 2019 11:24:00 AM MST, ERROR](ItemMasterMQRawMat.java:read():388) - read() - XPathExpressionException --> java.lang.NoClassDefFoundError: Could not initialize class com.sun.org.apache.xml.internal.serializer.Encodings

Mebin Joe
  • 2,172
  • 4
  • 16
  • 22
Octo Paul
  • 11
  • 1

0 Answers0