You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aidan Monroe <km...@yahoo.com> on 2003/03/21 02:45:34 UTC

Error In Tomcat But Not WebLogic

I have a .war file that runs perfectly in WebLogic
7.0. Today I tried to run that same .war in Tomcat
4.0.6. Unfortunately, it did not run. I get the
following error:

java.lang.IllegalStateException: Cannot forward after
response has been committed

Now, I know what this error means, but I don't know
why I would get it when I run in Tomcat but not
WebLogic. Is there something that I need to set in
Tomcat to avoid this?

Please note that I am new to Tomcat so I apologize in
advance if this is a stupid question.

Aidan

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Error In Tomcat But Not WebLogic

Posted by Peter Lin <tc...@yahoo.com>.
 
I will second the remarks about this particular behavior. It is a bug and isn't normal behavior. I believe the behavior was present in version 5 and 6.
 
the solution is to well, not do that, since it's not logical. what I ended up doing was to place the sendRedirect logic at the top of a JSP page and redirecting before anything happens. that was the only way i could ensure correct behavior, especially when redirects and forwards were used together to direct a request.
 
peter
 
 Tim Funk <fu...@joedog.org> wrote:Weblogic isn't the best at obeying the spec. (From past painful experience)

You probably have code which is sending data to the browser and then the 
response is getting committed. Then you try a 
RequestDispatcher.forward(). This is illegal with respect to the spec. 
It could be because weblogic had a larger buffer than tomcat before 
flushing. See the jsp(and/or servlet) spec for the declaration to 
enlarge the buffer for your request.

A simple way to reproduce:
    /* Write a 50kb string to ensure response is committed */
    char[] c = new char[1024*50];
    java.util.Arrays.fill(c,'z')
    out.println(new String(c));
%>


---------------
Another common way is to get this error is by performing a sendRedirect 
in a jsp and then printing more data out, for example:

Wacky text here.
---------------

A simple way to resolve:
    return;
%>
Wacky text here.


-Tim

Aidan Monroe wrote:
> I have a .war file that runs perfectly in WebLogic
> 7.0. Today I tried to run that same .war in Tomcat
> 4.0.6. Unfortunately, it did not run. I get the
> following error:
> 
> java.lang.IllegalStateException: Cannot forward after
> response has been committed
> 
> Now, I know what this error means, but I don't know
> why I would get it when I run in Tomcat but not
> WebLogic. Is there something that I need to set in
> Tomcat to avoid this?
> 
> Please note that I am new to Tomcat so I apologize in
> advance if this is a stupid question.
> 
> Aidan
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

Re: Problem with a Database ConnectionPool

Posted by Salina Cheung <sa...@yahoo.com>.
Have same problem.

When classes are reloaded, number of DB connections
exceeds the max number of connections allowed. 
crashing my DB server. 

Any fixes?

Thanks.




__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Error In Tomcat But Not WebLogic

Posted by Aidan Monroe <km...@yahoo.com>.
> It could be because weblogic had a larger buffer
> than tomcat before 
> flushing. 

Thanks, that sounds like it might be it as I am 99%
certain that I am not committing the response and then
sending more data, which I know is against the spec.

I'll look into the buffer size of WebLogic compared to
Tomcat.

Thanks.

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Error In Tomcat But Not WebLogic

Posted by Tim Funk <fu...@joedog.org>.
Weblogic isn't the best at obeying the spec. (From past painful experience)

You probably have code which is sending data to the browser and then the 
response is getting committed. Then you try a 
RequestDispatcher.forward(). This is illegal with respect to the spec. 
It could be because weblogic had a larger buffer than tomcat before 
flushing. See the jsp(and/or servlet) spec for the declaration to 
enlarge the buffer for your request.

A simple way to reproduce:
<%
    /* Write a 50kb string to ensure response is committed */
    char[] c = new char[1024*50];
    java.util.Arrays.fill(c,'z')
    out.println(new String(c));
%>
    <jsp:forward page="moreCowbell.jsp"/>

---------------
Another common way is to get this error is by performing a sendRedirect 
in a jsp and then printing more data out, for example:
<% response.sendRedirect("moreCowbell.jsp");%>
Wacky text here.
---------------

A simple way to resolve:
<% response.sendRedirect("moreCowbell.jsp");
    return;
%>
Wacky text here.


-Tim

Aidan Monroe wrote:
> I have a .war file that runs perfectly in WebLogic
> 7.0. Today I tried to run that same .war in Tomcat
> 4.0.6. Unfortunately, it did not run. I get the
> following error:
> 
> java.lang.IllegalStateException: Cannot forward after
> response has been committed
> 
> Now, I know what this error means, but I don't know
> why I would get it when I run in Tomcat but not
> WebLogic. Is there something that I need to set in
> Tomcat to avoid this?
> 
> Please note that I am new to Tomcat so I apologize in
> advance if this is a stupid question.
> 
> Aidan
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Error In Tomcat But Not WebLogic

Posted by Romualdo Rubens de Freitas <ro...@sercomtel.com.br>.
Aidan,

If you know what that error means, you should also know that it
violates Servlet specification. Maybe WebLogic has a pseudo-bug,
because it allows for you to send the buffer response to the server
and yet allows for you to keep filling it up.

Just my thoughts.

Best regards,
Romualdo Rubens de Freitas
mailto:romualdo@sercomtel.com.br


Aidan Monroe escreveu:
> I have a .war file that runs perfectly in WebLogic
> 7.0. Today I tried to run that same .war in Tomcat
> 4.0.6. Unfortunately, it did not run. I get the
> following error:
> 
> java.lang.IllegalStateException: Cannot forward after
> response has been committed
> 
> Now, I know what this error means, but I don't know
> why I would get it when I run in Tomcat but not
> WebLogic. Is there something that I need to set in
> Tomcat to avoid this?
> 
> Please note that I am new to Tomcat so I apologize in
> advance if this is a stupid question.
> 
> Aidan
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
> http://platinum.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> .
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org