Hi All,
We have a java code that split the XML file into multiple files. The same code works as expected when we call it from eclipse & also from unix machine. But when we call the same code from BPEL using Java Embedding it reads the content from file but it fails to find the node. It shows node length as 0. Please find below the java code:
<bpelx:exec import="java.io.*"/>
<bpelx:exec import="javax.xml.parsers.DocumentBuilderFactory"/>
<bpelx:exec import="javax.xml.xpath.XPath"/>
<bpelx:exec import="javax.xml.xpath.XPathConstants"/>
<bpelx:exec import="javax.xml.xpath.XPathFactory"/>
<bpelx:exec import="org.w3c.dom.Document"/>
<bpelx:exec import="org.w3c.dom.NodeList"/>
try {
File input = new File(FilePath+FileName);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document doc = dbf.newDocumentBuilder().parse(input);
XPath xpath = XPathFactory.newInstance().newXPath();
NodeList nodes = (NodeList) xpath
.evaluate("//ItemMaintenance/Batch/Item", doc,
XPathConstants.NODESET);
System.out.println("Node Length " + nodes.getLength());
} catch (Exception e) {
e.printStackTrace();
}
Could you please let me know what would be the problem? we suspect the jar containing org.w3c.dom.Document and org.w3c.dom.NodeList classes used while running the java code from unix prompt (Server environment variables) and while running the BPEL code are different (SOA server classpath) are different. Could it be the case? If so how can i overcome this? please help...
Java Version: 1.6
SOA Version: 11.1.1.5.0 (PS4)
Thanks in Advance.