xpath query in a servlet gives exception

Posted by user1401071 on Stack Overflow See other posts from Stack Overflow or by user1401071
Published on 2012-06-21T20:56:41Z Indexed on 2012/06/21 21:16 UTC
Read the original article Hit count: 573

Filed under:
|
|
|

I have a Document object initialized in the init() method of the servlet and use it in the doPost() method to service the requests.

selectNodeList() xpath query gives exception when the servlet services many request at same time. The Exception is shown below:

Caused by: javax.xml.transform.TransformerException: -1
    at org.apache.xpath.XPath.execute(XPath.java:331)
    at org.apache.xpath.CachedXPathAPI.eval(CachedXPathAPI.java:328)
    at org.apache.xpath.CachedXPathAPI.selectNodeList(CachedXPathAPI.java:255)
    at org.apache.xpath.CachedXPathAPI.selectNodeList(CachedXPathAPI.java:235)
    at com.pro.bb.servlets.Controller.getDataOrPeriodForReport(Controller.java:511)
    ... 23 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at org.apache.xpath.XPathContext.pushCurrentNode(XPathContext.java:808)
    at org.apache.xpath.axes.PredicatedNodeTest.acceptNode(PredicatedNodeTest.java:447)
    at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:409)
    at org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:176)
    at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:320)
    at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:474)
    at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:257)
    at org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:257)
    at org.apache.xpath.XPath.execute(XPath.java:308)

Help me sort out the issue.

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets