You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "J.Pietschmann" <j3...@yahoo.de> on 2002/05/30 22:05:12 UTC

C2 on Websphere 3.5: IllegalStateException

Hello,
finally I managed to get Cocoon 2.0.2 running on Websphere 3.5.
However, I keep getting IllegalStateExceptions, in particular
if a ressource is missing because of this code in
  CocoonServlet.java:1019 ff:
                 res.sendError(res.SC_NOT_FOUND);

                 SimpleNotifyingBean n = new SimpleNotifyingBean(this);
                 n.setType("resource-not-found");
                 ...
                 // send the notification but don't include it in the output stream
                 // as the status SC_NOT_FOUND is enough
                 res.setContentType(Notifier.notify(n, (OutputStream)null));

Apparently Tomcat tolerates the setContentType() after a
sendError(), Websphere 3.5 has already it's response committed
at this point and throws the IllegalStateException.

I'm not an expert in servlet programming, nevertheless the code
seems to be a bit odd to me. Is there a specific reason for
setting the content type after the sendError()? I'd send the
error after having set the content type...

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: C2 on Websphere 3.5: IllegalStateException

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "J.Pietschmann" <j3...@yahoo.de>

> Nicola Ken Barozzi wrote:
> > From: "J.Pietschmann" <j3...@yahoo.de>
> > I think I wrote that comment more than a year ago :-|
> > ... it's time I take a deeper look into it.
> > It should throw a RNF exception, not get there...
> > 
> > Anyway, the senderror part is wrong as you pointed out :-/
> 
> A quick recommendation on how to fix (rather hack) it?
> Omitting building the notification and simply return after
> the sendError()? 

yes, I just checked the code; just do the senderror and return for now.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: C2 on Websphere 3.5: IllegalStateException

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Nicola Ken Barozzi wrote:
> From: "J.Pietschmann" <j3...@yahoo.de>
> I think I wrote that comment more than a year ago :-|
> ... it's time I take a deeper look into it.
> It should throw a RNF exception, not get there...
> 
> Anyway, the senderror part is wrong as you pointed out :-/

A quick recommendation on how to fix (rather hack) it?
Omitting building the notification and simply return after
the sendError()? I'm not after the final, perfect patch...

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: C2 on Websphere 3.5: IllegalStateException

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "J.Pietschmann" <j3...@yahoo.de>

> Hello,
> finally I managed to get Cocoon 2.0.2 running on Websphere 3.5.
> However, I keep getting IllegalStateExceptions, in particular
> if a ressource is missing because of this code in
>   CocoonServlet.java:1019 ff:
>                  res.sendError(res.SC_NOT_FOUND);
>
>                  SimpleNotifyingBean n = new SimpleNotifyingBean(this);
>                  n.setType("resource-not-found");
>                  ...
>                  // send the notification but don't include it in the
output stream
>                  // as the status SC_NOT_FOUND is enough
>                  res.setContentType(Notifier.notify(n,
(OutputStream)null));
>
> Apparently Tomcat tolerates the setContentType() after a
> sendError(), Websphere 3.5 has already it's response committed
> at this point and throws the IllegalStateException.
>
> I'm not an expert in servlet programming, nevertheless the code
> seems to be a bit odd to me. Is there a specific reason for
> setting the content type after the sendError()? I'd send the
> error after having set the content type...

Yes, Houston, we have a problem.

I think I wrote that comment more than a year ago :-|
... it's time I take a deeper look into it.
It should throw a RNF exception, not get there...

Anyway, the senderror part is wrong as you pointed out :-/

--
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org