Hi png, Does the exception occur when only one client request at a time is sent into the method? If so, then digging deeper seems warranted. But if you experience this exception while multiple clients are concurrently accessing the Servlet that calls the method, then no further explanation seems necessary.
Anyway, someone else might have a better suggestion. I was thinking maybe the whole method should be synchronized too. I'm going to download the Xerces-J source anyway, so I'll check out the class that throws the exception. Scott Stirling > -----Original Message----- > From: png [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 07, 2002 2:34 PM > To: '[EMAIL PROTECTED]' > Subject: RE: Help with ConcurrentModificationException! > > > Hi, thanks for your suggestion, but in one my revisions of > the code i had synchronized the parse.parse call... i'm > understand that SAXParsers are not re-entrant, but i'm not > sure how it applies in this situation where i make a call to > it from another object... or maybe i'm just missing it > completely... any more suggestions would be very much appreciated... > > Thanks! > > -----Original Message----- > From: Scott Stirling [mailto:[EMAIL PROTECTED] > Sent: Monday, May 06, 2002 8:28 PM > To: [EMAIL PROTECTED] > Subject: RE: Help with ConcurrentModificationException! > > > Hi Peter, > > SAX parsers are not allowed to be re-entrant. Servlets are > re-entrant by default unless they implement > SingleThreadModel. Try adding a synchronized block around > the parser.parse(new XSLTInputSource(is)); call. > > Best, > Scott Stirling > > > -----Original Message----- > > From: png [mailto:[EMAIL PROTECTED] > > Sent: Monday, May 06, 2002 6:27 PM > > To: '[EMAIL PROTECTED]' > > Subject: Help with ConcurrentModificationException! > > > > > > Hey all, > > > > Please let me know if this is not an appropriate topic for > > this mailing list. I apologize if it isn't. > > > > I get this exception when i'm using the Xerces SAXParser. > > I'm using Apache/Resin running Java 1.3.1/Xerces 1.4.4 The > > exception is: java.util.ConcurrentModificationException > > at > > org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1111) > > at > > com.kargo.comfy.translator.Translator.process(Translator.java:155) > > at > > com.kargo.comfy.translator.TranslatorServlet.service(Translato > > rServlet.java: > > 181) > > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:83) > > at > > com.caucho.server.http.QNamedDispatcher.service(QNamedDispatch > > er.java:153) > > at > > com.caucho.server.http.QNamedDispatcher.chain(QNamedDispatcher > > .java:100) > > at > > com.caucho.server.http.AbstractRequest.service(AbstractRequest > > .java:472) > > at > > com.caucho.server.http.AbstractRequest.service(AbstractRequest > > .java:395) > > at > > com.caucho.server.http.PageCache$Entry.service(PageCache.java:256) > > at > > com.caucho.server.http.PageCache.service(PageCache.java:105) > > at > > com.caucho.server.http.VirtualHost.service(VirtualHost.java:406) > > at com.caucho.server.http.Request.dispatch(Request.java:211) > > at > > com.caucho.server.http.RunnerRequest.handleRequest(RunnerReque > > st.java:307) > > at > > com.caucho.server.http.RunnerRequest.handleConnection(RunnerRe > > quest.java:257 > > ) > > at > com.caucho.server.TcpConnection.run(TcpConnection.java:139) > > at java.lang.Thread.run(Thread.java:484) > > > > The code that calls parse is this. Its within this > > Translator class I've > > built: > > /** > > * Sets the states for all filterhandlers using the > > * the servlet request and response objects then > > * instructs the SAX parser to begin parsing the > > * input stream using a stylesheet root for the translation > > * > > * @param deviceId The id of the device we're talking to > > * @param is xml to translate > > * @param os stream to send output > > * @param ssr compiled stylesheet to use for translation > > * @param req HttpServletRequest to be passed to filter handlers > > * @param res HttpServletResponse to be passed to > filter handlers > > * @return void > > * @throws org.xml.sax.SAXException, java.io.IOException > > */ > > public void process(InputStream is, > > OutputStream os, StylesheetRoot ssr, > > HttpServletRequest req, > > HttpServletResponse res, > > String encoding) > > throws SAXException, IOException, Exception > > { > > setFilterStates(req, res); > > processor.setOutputStream(os); > > processor.setStylesheet(ssr); > > // this won't really work... > > processor.setStylesheetParam("encoding", > > processor.createXString(encoding)); > > parser.parse(new XSLTInputSource(is)); > > reset(); > > } > > > > I believe there may be issues with perhaps using the single > > parser and processor multiple times and just resetting it. > > That is what the reset() method does. "parser" is a Xerces > > SAXParser and "processor" is an XSLTProcessor, both as > > instance variables. Any suggestions as to why this is > > throwing such an exception? > > > > Thanks! > > > > peter > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
