• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAXException within Servlet

 
Richard Lawrence
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I keep get the following error within my servlet
on trying to parse an xml document.
(i.e Some times it works)
The error message is:-
Error in getDocument rg.xml.sax.SAXException: FWK005 parse may not be called while parsing.
The following is part of the code:-
import org.apache.xerces.parsers.DOMParser;
DOMParser parser = new DOMParser();

public Document getDocument(String inXML) throws Exception
{
StringReader stringReader =
new StringReader(inXML);
InputSource inSource =
new InputSource(stringReader);
parser.reset();
parser.parse(inSource);
return parser.getDocument();
}
The xml string that i'm sending in is:-
<?xml version="1.0" ?><OrderStatus OrderNo="NW6661" EnterpriseCode="NETV"/>
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This error message usually shows up when one parse() method invocation oversteps a parsing process in progress. For instance, when there is an attempt to invoke the
parse method on a parser object while another parse (with the same parser
object) is still in progress.
This can happen for example, when multiple threads sharing the same parser instance try to invoke the parse() method. Check your code for such scenarios. If nothing helps, you can simply wrap the parse() call within a synchronized method.
Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic