Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

XPath Problem

843834Jul 7 2002 — edited Jul 9 2002
I am using XPathAPI from xalan. I get NoMethod error on getNameSpaceURI at the line where I call XPathAPI. Just to check I tried calling getNameSpaceURI method on Node to find out.
The order in which JARs appear is
dom.jar;jaxp.jar;jaxp-api.jar;xercesImpl.jar;xalan.jar;xsltc.jar;crimson.jar;saxon-jdom.jar;xml.jar;xmlParserAPIs.jar;xml-apis.jar;

Most them seem to have Node.class. I tried altering the order it did not help much. If don't call getNameSpaceURI I do not get the comilation error but the run time error as after the code below.

Please help


Document doc = null;
try {
StringReader str = new StringReader(XMLField);
InputSource input = new InputSource(str);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(input);
}
catch (Exception e) {
e.printStackTrace();
}

Node contact = null;
try {
Node n = (Node) doc;
// System.out.println("Name Space is " + n.getNameSpaceURI());
contact = XPathAPI.selectSingleNode((Node)doc, "/contact");
}
catch (Exception e) {
ServletUtility.log(e);
throw new ServletException(e.toString());
}



Sun Jul 07 22:38:37 GMT+10:00 2002:<E> <ServletContext-General> Servlet failed w
ith Exception
java.lang.NoSuchMethodError: org.w3c.dom.Node: method getNamespaceURI()Ljava/lan
g/String; not found
at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.addNode(DOM2DTM.java:293)
at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.<init>(DOM2DTM.java:162)
at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.jav
a:291)
at org.apache.xml.dtm.ref.DTMManagerDefault.getDTMHandleFromNode(DTMMana
gerDefault.java:606)
at org.apache.xpath.XPathContext.getDTMHandleFromNode(XPathContext.java:
219)
at org.apache.xpath.XPathAPI.eval(XPathAPI.java:283)
at org.apache.xpath.XPathAPI.selectNodeIterator(XPathAPI.java:172)
at org.apache.xpath.XPathAPI.selectSingleNode(XPathAPI.java:133)
at org.apache.xpath.XPathAPI.selectSingleNode(XPathAPI.java:113)
at company.ProcessCompanyServlet.doGet(ProcessCompanyServlet.java:127)
at company.ProcessCompanyServlet.doPost(ProcessCompanyServlet.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:106)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
textImpl.java:907)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
textImpl.java:851)
at weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
ContextManager.java:252)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
a:364)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2002
Added on Jul 7 2002
10 comments
455 views