• Post Reply Bookmark Topic Watch Topic
  • New Topic

IllegalStateException

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is this exception? why can be the problem? what to do in this case?



Thanks.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There could be several causes, but one typical cause is when a JSP throws an exception after it has already written a significant part of the output to the client.

When the JSP sends a response, the output gets buffered. Once the buffer fills and gets sent, the response is consiidered 'commited' and it is too late to decide to send something different to the client. Therefore if the response is committed and an exception is thrown, the container will try to forward to the error page, but it is too late to forward.

One bad way to solve this is to increase the size of the response buffer. It is much better to look for the resulting error and fix this. Defensive programming like testing for null values help, it also helps to use tag libraries rather than scriptlets.

Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!