[jdom-interest] JDOM in JSP/Bean/Tomcat (JDOMBean)

Louis Tribble louis.tribble at metamata.com
Thu Jun 22 18:16:48 PDT 2000


Jon Baer wrote:
> 
> After I couldnt get the JDOMBean to work in my Tomcat 3.1 (Win32), I decided to simply do
> something else without using the bean:
> 
> <%
> java.io.InputStream is = getServletContext().getResourceAsStream("/WEB-INF/config.xml");
> org.jdom.input.SAXBuilder builder = new
> org.jdom.input.SAXBuilder("org.apache.xerces.parsers.SAXParser");
> org.jdom.Document doc = builder.build(is);
> %>
> 
> What I keep getting back is:
> java.lang.IllegalStateException: Response has already been committed
> 
> Anyone have any idea what is causing this problem?

I'm not sure if it got fixed for tomcat 3.1 or not, but it used to be 
the case that an exception in your code could trigger this outcome 
(there can also be legitimate causes of this exception). In my case it 
was a SQLException: the generated exception handler in the JSP page 
would try to forward to the error page but the response was already 
committed and so IllegalStateException would be thrown. What I 
considered to be a bug was that all trace of the original exception was 
lost. We reported a bug and something was done on it, so it may no 
longer be a problem, but you can embed a try-catch block with a println 
in your page to determine if this is happening.

HTH,
Louis
-- 

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Louis Tribble                                         louis at metamata.com
Metamata, Inc.                                   http://www.metamata.com
Tools for serious Java developers.                       +1 510 796 0915
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>



More information about the jdom-interest mailing list