RE: Illegal State Exception

2001-12-19 Thread SHeyns

You are doing something like  res.getOutputStream().write(data); twice
within the same request. This could be for several reasons and it general
occurs when you include a page in your response and then try to use the
above - you can do a response.isCommited() to check the state of the
response.
 

-Original Message-
From: Justin Rowles [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 10:03 AM
To: 'Tomcat Users List'
Subject: Illegal State Exception


At intervals I get this error (or very similar).  I have previously got rid
of it by removing what I last did!

Last time, it appeared to be caused by calling the first() method on a
ResultSet.  This time I have made several changes and have no idea what the
cause is.

How can I pursue it through my code from the information I have below?

Justin.
-- 
You're only jealous cos the little penguins are talking to me. 

Error: 500
Location: /pod_users/justin/jsp/form.jsp
Internal Servlet Error:

java.lang.IllegalStateException: Response has already been committed
at
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletRespon
seFacade.java:157)
at
org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:156)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
at java.lang.Thread.run(Thread.java:484)



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception

2001-12-19 Thread Justin Rowles

> You are doing something like  res.getOutputStream().write(data); twice
> within the same request. This could be for several reasons 
> and it general
> occurs when you include a page in your response and then try 
> to use the
> above - you can do a response.isCommited() to check the state of the
> response.

I don't use any output streams in the system.

I don't use any includes.

I do use a jdbc driver for mySQL and the problem could well be in there
(both recent problems have occurred shortly after changes to the database
access routines).

Any further ideas?  Mostly I would like to know any way that I can get
enough information to trace the issue myself.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception

2001-12-19 Thread SHeyns

I would begin by examining the form on which the error occured as indicated
by the message. You should locate the source code under the
TOMCAT_HOME/work/{webcontext}/.../form_jsp_{Highest number}.java That should
show the source of the problem form and from there you should be able to
determine the cause

(Assuming that is the form you are loading and getting the error on)


Error: 500
Location: /pod_users/justin/jsp/form.jsp
Internal Servlet Error:

-Original Message-
From: Justin Rowles [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 10:37 AM
To: 'Tomcat Users List'
Subject: RE: Illegal State Exception


> You are doing something like  res.getOutputStream().write(data); twice
> within the same request. This could be for several reasons 
> and it general
> occurs when you include a page in your response and then try 
> to use the
> above - you can do a response.isCommited() to check the state of the
> response.

I don't use any output streams in the system.

I don't use any includes.

I do use a jdbc driver for mySQL and the problem could well be in there
(both recent problems have occurred shortly after changes to the database
access routines).

Any further ideas?  Mostly I would like to know any way that I can get
enough information to trace the issue myself.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Illegal State Exception

2001-12-20 Thread tomcat-user-return-5492-archive=jab . org

> I would begin by examining the form on which the error 
> occured as indicated by the message. You should locate the source code
under the
> TOMCAT_HOME/work/{webcontext}/.../form_jsp_{Highest 
> number}.java That should
> show the source of the problem form and from there you should 
> be able to determine the cause

Unfortunately that form is only mentioned in the server error message cos
that is the one that was called.  The stack trace (see previous message)
does not mention my form at all.

FWIW, I am familiar with checking the generated servlet.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception - Further information.

2001-12-19 Thread Justin Rowles

> At intervals I get this error (or very similar).  I have 
> previously got rid of it by removing what I last did!

I have commented out all my recent additions, and the system worked again.

I then uncommented all my comments, one by one, and guess what?  It still
works.

Anyone got any ideas?

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception - Further information.

2001-12-19 Thread Larry Isaacs

The Servlet spec says that you can not call
HttpServletResponse.sendError() once output has been
committed to the browser.  If you do so, you get
the IllegalStateException you are seeing.  With
content already sent, it is too late to do a 
redirection.

Content will automatically be committed once the
buffer becomes full (I think the default is 8K).
If the amount of content written to the buffer
before the error occurs varies, it can cause the
appearance of this error to be variable too.

Increasing the size of the buffer would delay the
automatic committing of content and perhaps
help avoid this error.

Cheers,
Larry

> -Original Message-
> From: Justin Rowles [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 19, 2001 11:27 AM
> To: 'Tomcat Users List'
> Subject: RE: Illegal State Exception - Further information.
> 
> 
> > At intervals I get this error (or very similar).  I have 
> > previously got rid of it by removing what I last did!
> 
> I have commented out all my recent additions, and the system 
> worked again.
> 
> I then uncommented all my comments, one by one, and guess 
> what?  It still
> works.
> 
> Anyone got any ideas?
> 
> J.
> -- 
> You're only jealous cos the little penguins are talking to me. 
> 
> 
> 
> ***
> For more information on Ordnance Survey products and services,
> visit our web site at http://www.ordnancesurvey.co.uk
> ***
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Illegal State Exception - Further information.

2001-12-20 Thread tomcat-user-return-5493-archive=jab . org

> The Servlet spec says that you can not call
> HttpServletResponse.sendError() once output has been
> committed to the browser.  If you do so, you get
> the IllegalStateException you are seeing.  With
> content already sent, it is too late to do a 
> redirection.

AH!  *So*, the theory here is that I am generating more than the 8kb of
data, which is being autocommited to the browser, then an error occurs and
the servlet cannot send the error, but instead raises this exception.  Got
it.

In fact, I write a large form back in html.  If the last element were to be
null, and I try to write out a value thus:

<%= myObject.myProperty %>

then I would get this error as the servlet cannot raise a null pointer
exception as it would generally do.  Is that right?

I shall try this today, as it may well explain everything.

Justin.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception - Even more!

2001-12-20 Thread Justin Rowles

> AH!  *So*, the theory here is that I am generating more than 
> the 8kb of data, which is being autocommited to the browser, 
> then an error occurs and the servlet cannot send the error, 
> but instead raises this exception.  Got it.
> 
> In fact, I write a large form back in html.  If the last 
> element were to be
> null, and I try to write out a value thus:

Sadly, I raised the memory to 500kb, carried on developing and just got this
a fwe minutes ago:

Error: 500

Location: /pod_users/justin/jsp/form.jsp

Internal Servlet Error:

java.lang.IllegalStateException: Response has already been committed
at
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletRespon
seFacade.java:157)
at
org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:156)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
at java.lang.Thread.run(Thread.java:484)

Which again leaves me none the wiser in terms of tracing the error.

HOWEVER I have just had a realisation.  I had just altered and rebuilt some
of the classes that operate behind the scenes and one of them had failed and
so wasn't present in the .jar file.  I corrected it and rebuild the .jar and
the error went away.

Now, I would have expected an error about not being able to instantiate the
class, but the above is what I got (simply reproduceable too I should
think).  Is this a bug?  I guess not, just a feature of how the containter
falls over when you pull the rug out from under its feet.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception - Even more!

2001-12-20 Thread Larry Isaacs

The increase in memory probably didn't affect the buffer
size.  For JSP, the JspWriter's buffer may be increased
with:

<%@ page buffer="size" %>

where the "size" is a value in kbytes, i.e. "32" or "32kb".
The default is "8kb".

For servlets, you can use:

ServletResponse.setBufferSize(size);

where size is in bytes.  The default is also 8k.  Be sure
to call setBufferSize() before writting any content or you
will get another form of IllegalStateException.

Cheers,
Larry




> -Original Message-
> From: Justin Rowles [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 20, 2001 10:03 AM
> To: 'Tomcat Users List'
> Subject: RE: Illegal State Exception - Even more!
> 
> 
> > AH!  *So*, the theory here is that I am generating more than 
> > the 8kb of data, which is being autocommited to the browser, 
> > then an error occurs and the servlet cannot send the error, 
> > but instead raises this exception.  Got it.
> > 
> > In fact, I write a large form back in html.  If the last 
> > element were to be
> > null, and I try to write out a value thus:
> 
> Sadly, I raised the memory to 500kb, carried on developing 
> and just got this
> a fwe minutes ago:
> 
> Error: 500
> 
> Location: /pod_users/justin/jsp/form.jsp
> 
> Internal Servlet Error:
> 
> java.lang.IllegalStateException: Response has already been committed
> at
> org.apache.tomcat.core.HttpServletResponseFacade.sendError(Htt
> pServletRespon
> seFacade.java:157)
> at
> org.apache.jasper.runtime.JspServlet.unknownException(JspServl
> et.java:299)
> at 
> org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377)
> at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWra
> pper.java:503)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> cessConnection
> (Ajp12ConnectionHandler.java:156)
> at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEnd
> point.java:338
> )
> at java.lang.Thread.run(Thread.java:484)
> 
> Which again leaves me none the wiser in terms of tracing the error.
> 
> HOWEVER I have just had a realisation.  I had just altered 
> and rebuilt some
> of the classes that operate behind the scenes and one of them 
> had failed and
> so wasn't present in the .jar file.  I corrected it and 
> rebuild the .jar and
> the error went away.
> 
> Now, I would have expected an error about not being able to 
> instantiate the
> class, but the above is what I got (simply reproduceable too I should
> think).  Is this a bug?  I guess not, just a feature of how 
> the containter
> falls over when you pull the rug out from under its feet.
> 
> J.
> -- 
> You're only jealous cos the little penguins are talking to me. 
> 
> 
> 
> ***
> For more information on Ordnance Survey products and services,
> visit our web site at http://www.ordnancesurvey.co.uk
> ***
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Illegal State Exception - Even more!

2001-12-20 Thread Justin Rowles

> The increase in memory probably didn't affect the buffer
> size.  For JSP, the JspWriter's buffer may be increased
> with:
> <%@ page buffer="size" %>

Whoops, didn't say what I meant.  That (the above) is exactly what I did -
to 500kb

I can get a "Response has already been committed" exception at will by
compiling the jsp, then removing a class file from a jar.  Putting the class
file back in the jar again removes the error.

Justin.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Illegal State Exception - Even more!

2001-12-20 Thread Larry Isaacs

If the class in question isn't involved in the amount
of content written, then I don't have an explanation.

If possible, you could sprinkle some JspWriter.getRemaining()
calls around to see if you can detect any differences
when the class is present or not.

Cheers,
Larry

> -Original Message-
> From: Justin Rowles [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 20, 2001 10:44 AM
> To: 'Tomcat Users List'
> Subject: RE: Illegal State Exception - Even more!
> 
> 
> > The increase in memory probably didn't affect the buffer
> > size.  For JSP, the JspWriter's buffer may be increased
> > with:
> > <%@ page buffer="size" %>
> 
> Whoops, didn't say what I meant.  That (the above) is exactly 
> what I did -
> to 500kb
> 
> I can get a "Response has already been committed" exception at will by
> compiling the jsp, then removing a class file from a jar.  
> Putting the class
> file back in the jar again removes the error.
> 
> Justin.
> -- 
> You're only jealous cos the little penguins are talking to me. 
> 
> 
> 
> ***
> For more information on Ordnance Survey products and services,
> visit our web site at http://www.ordnancesurvey.co.uk
> ***
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Illegal State Exception - Even more!

2001-12-20 Thread tomcat-user-return-5557-archive=jab . org

> If the class in question isn't involved in the amount
> of content written, then I don't have an explanation.

The method I was calling returns a String which is returned to a method in
another class and returned again to the call in the jsp where it is written
out as output.

Does that count?! ;-)

> If possible, you could sprinkle some JspWriter.getRemaining()
> calls around to see if you can detect any differences
> when the class is present or not.

Whassat then?  

Oh, right, yeah, OK, I can do that, and send the output to our logging
facility.  I'll let you know the results.  Do please (anyone) answer the
above first though, in case it makes the rest irrelevent.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Illegal State Exception while redirecting

2003-12-18 Thread Bill Barker
The spec forbids an included page from changing the headers or the status
code (Section 8.3 of the 2.3 Servlet Spec, which is what TC 4.1 follows).
This means that it is illegal to call sendRedirect from an included page
(and doubly so from one with flush="true" :).

"Kumar, Sumit" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I am including a jsp header in every jsp page as follows:
>
> 
>
> In this header, I call a class that checks if the valid user objects
exists
> in session. Otherwise the class returns authentication as false. If the
user
> object donot exist I redirect to another web site using
> response.sendRedirect.
>
> However I get illegal state Exception (java.lang.IllegalStateException
> at
>
org.apache.coyote.tomcat4.CoyoteResponseFacade.sendRedirect(CoyoteResponseFa
> cade.java:340)
>
> Any suggestions please..
>
>  The page of header is as follows:
>
> <%
>boolean isAuthenticated =
>
AuthenticationManager.authenticate(request.getParameter("userId")==null?"":r
> equest.getParameter("userId"),
>
>
request.getParameter("password")==null?"":request.getParameter("password"),s
> ession);
>if(!isAuthenticated)
>{
>System.out.println("\n AUTHENTICATION FAILED");
>
>
>
response.sendRedirect("http://sgtwebdv/gm?format=Sogeti/testAuth/portalHead.
> shtml&appId=1&ul=/reports.jsp");
>return;
>}
> %>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]