java - Causes for IllegalStateException -


i'm getting illegalstateexception tomcat server, when try save jsp's data in excel. illegalstateexception can occur in of following condition:

  • if there no return statement after sendredirect().
  • if post size greater 2mb.
  • if page buffer size less.

other this, there causes illegalstateexception?

my code:

response.sendredirect(response.encoderedirecturl(request.getrequesturi() + "?savetofile=true&action=" + reportsmanager.action_save_as_xls + "&savefilename=" + savefilename + "&returnpage=" + stringfunctions.encodeurlparameter(returnpage)));     return; 

i'm getting illegalstateexception @ sendredirect().

also if there few records (say 100 rows) in jsp, there no error in saving excel. if there 1000 records, i'm getting illegalstateexception.

stack trace:

*mar 25, 2013 6:57:26 am,jsp runtime error,0,java.lang.illegalstateexception        @ org.apache.coyote.tomcat5.coyoteresponsefacade.sendredirect(coyoteresponsefacade.java:352)        @ org.apache.jsp.operationalreports.salespersonsales_jsp._jspservice(salespersonsales_jsp.java:2567)        @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:94)        @ javax.servlet.http.httpservlet.service(httpservlet.java:802)        @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:324)        @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:292)        @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:236)        @ javax.servlet.http.httpservlet.service(httpservlet.java:802)        @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:237)        @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:157)        @ com.retailjava.core.filters.securityfilter.dofilter(securityfilter.java:136)        @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:186)        @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:157)        @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:214)        @ org.apache.catalina.core.standardvalvecontext.invokenext(standardvalvecontext.java:104)        @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:520)        @ org.apache.catalina.core.standardcontextvalve.invokeinternal(standardcontextvalve.java:198)        @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:152)        @ org.apache.catalina.core.standardvalvecontext.invokenext(standardvalvecontext.java:104)        @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:520)        @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:137)        @ org.apache.catalina.core.standardvalvecontext.invokenext(standardvalvecontext.java:104)        @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:118)        @ org.apache.catalina.core.standardvalvecontext.invokenext(standardvalvecontext.java:102)        @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:520)        @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109)        @ org.apache.catalina.core.standardvalvecontext.invokenext(standardvalvecontext.java:104)        @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:520)        @ org.apache.catalina.core.containerbase.invoke(containerbase.java:929)        @ org.apache.coyote.tomcat5.coyoteadapter.service(coyoteadapter.java:160)        @ org.apache.coyote.http11.http11processor.process(http11processor.java:799)        @ org.apache.coyote.http11.http11protocol$http11connectionhandler.processconnection(http11protocol.java:705)        @ org.apache.tomcat.util.net.tcpworkerthread.runit(pooltcpendpoint.java:577)        @ org.apache.tomcat.util.threads.threadpool$controlrunnable.run(threadpool.java:683)        @ java.lang.thread.run(thread.java:595) 

if set page buffer size, worlks fine 1000 records. if reaches 2000 records, again i'm getting issue.

<%@ page buffer = "2048kb" autoflush = "true" %> 

the documentation states:

sendredirect throws: illegalstateexception - if response has been committed

since disabling maxpostsize not solve problem (according op comments) seems @ earlier point responce beeing commited.

you can verify checking iscommited flag.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -