0

I'm stuck on the following run-time error. I'm running code which read a xml file as input, this is the code: http://pastie.org/1617011. XML: http://pastie.org/1617014

Feb 28, 2011 4:07:29 PM org.apache.commons.digester.Digester peek
WARNING: Empty stack (returning null)
Feb 28, 2011 4:07:29 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
java.lang.NullPointerException
    at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:209)
    at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
    at org.apache.commons.digester.Rule.end(Rule.java:257)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.commons.digester.Digester.parse(Digester.java:1871)
    at QueryPerformer.main(QueryPerformer.java:127)
Exception in thread "main" java.lang.NullPointerException
    at org.apache.commons.digester.Digester.createSAXException(Digester.java:3363)
    at org.apache.commons.digester.Digester.createSAXException(Digester.java:3389)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1348)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.commons.digester.Digester.parse(Digester.java:1871)
    at QueryPerformer.main(QueryPerformer.java:127)
Caused by: java.lang.NullPointerException
    at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:209)
    at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
    at org.apache.commons.digester.Rule.end(Rule.java:257)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
    ... 12 more
3
  • Your XML file seems OK. Must be something with the file access or you Digester configuration. Commented Feb 28, 2011 at 15:15
  • Yeah, looks like a configuration problem. Post you digester config and the bean class you are trying to pop off into. As a guess, I'd say that your config refers to a property of your bean class that doesn't exist (though I would expect to see a more descriptive error in that case). Commented Feb 28, 2011 at 15:20
  • @Mark Peters @reef thanks, well I've used digester to parse another xml file with another class in the same environment and it worked perfectly. I've not set any digester config but just included the jar file in the classpath. Commented Feb 28, 2011 at 15:27

1 Answer 1

1

Are you sure you're correct when trying to cast the returned object to QueryPerformer when the parser configuration is set to create a QueryDoc? Also, seems that the method you pass into addSetNext is referring to a method in QueryPerformer, not QueryDoc and this is what the stacktrace seems to be pointing at as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.