時間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(0)
在用戶實際環(huán)境的tomcat日志(localhost_log.2009-06-22.txt)看到下面這個錯
引用:
2009-06-22 12:39:41 StandardWrapperValve[ajax]: Servlet.service() for servlet ajax threw exception
java.lang.IllegalStateException: Post too large
at org.apache.coyote.tomcat5.CoyoteRequest.parseRequestParameters(CoyoteRequest.java:2405)
at org.apache.coyote.tomcat5.CoyoteRequest.getParameter(CoyoteRequest.java:1073)
at org.apache.coyote.tomcat5.CoyoteRequestFacade.getParameter(CoyoteRequestFacade.java:265)
at org.ajaxanywhere.AAUtils.isAjaxRequest(AAUtils.java:34)
at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.thunisoft.summer.web.filter.CharsetFilter.doFilter(CharsetFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
#p#副標(biāo)題#e#
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
在另外一個catalina_log.2009-06-22.txt日志文件中,有下面這句話
引用:
2009-06-22 12:39:41 CoyoteRequest Parameters were not parsed because the size of the posted data was too big. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs.
上網(wǎng)查了一下,說是tomcat默認接收的POST提交數(shù)據(jù)最大為2M,如果沒有修改過配置post提交的數(shù)據(jù)超過這個就報上面的錯了。這個配置在%tomcat-5.0.28%conf\server.xml中的我們用到的connector節(jié)點的屬性。其中tomcat的文檔是這么描述的
引用:
maxPostSize
The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The feature can be disbled by setting this attribute to a value inferior or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
準備復(fù)現(xiàn)問題,第一個想到的就是三期文書是保存到數(shù)據(jù)庫的,并且為ajax的post方式提交(文件上傳不會報這個錯)
復(fù)制內(nèi)容到剪貼板
代碼:
var map = new Map();
map.put("key", "fy.doceditor.updateDoc");
map.put("jzjd", jzjd);
map.put("caseType", caseType);
map.put("caseId", caseId);
map.put("docId", docId);
map.put("wsxh", wsxh);
map.put("doc", docDetail);
var query = new QueryObj(map,updated);
query.send();
所以創(chuàng)建了一個文書,粘貼了一個8M的word文書,點保存之后報js錯。把上面這個docDetail保存成文件,發(fā)現(xiàn)大小為7.94 MB (8,332,134 字節(jié)),檢查日志有post too large錯。
按照文檔描述,修改xml文件配置如下:
引用:
maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" maxPostSize="0"/> 問題得到解決。 一般來說大部分post提交都是沒有問題的,但是還是要仔細考慮一下項目是否會出現(xiàn)這種情況,最好是修改一下tomcat的配置。有時候需要注意這個異常只會記錄在tomcat的日志文件中(列如北高三期)。 關(guān)鍵詞標(biāo)簽:tomcat5
相關(guān)閱讀
熱門文章 ISAPI Rewrite實現(xiàn)IIS圖片防盜鏈 IIS6.0下配置MySQL+PHP5+Zend+phpMyAdmin 在Windows服務(wù)器上快速架設(shè)視頻編解碼器全攻略 win2000server IIS和tomcat5多站點配置
人氣排行 XAMPP配置出現(xiàn)403錯誤“Access forbidden!”的解決辦法 WIN2003 IIS6.0+PHP+ASP+MYSQL優(yōu)化配置 訪問網(wǎng)站403錯誤 Forbidden解決方法 如何從最大用戶并發(fā)數(shù)推算出系統(tǒng)最大用戶數(shù) Server Application Unavailable的解決辦法 報錯“HTTP/1.1 400 Bad Request”的處理方法 Windows Server 2003的Web接口 http 500內(nèi)部服務(wù)器錯誤的解決辦法(windows xp + IIS5.0)