以下错误消息“java.io.IOException:Header部分太大”与rich:fileupload

时间:2014-04-14 16:10:40

标签: java file-upload jboss richfaces

我想附加一个250 MB的文件但是在执行附加以下错误的过程时会出现

10:25:02,458 ERROR [[Faces Servlet]] Servlet.service() para servlet Faces Servlet lanzó excepción
org.ajax4jsf.exception.FileUploadException: IO Error parsing multipart request
at org.ajax4jsf.request.MultipartRequest.getParam(MultipartRequest.java:556)
at org.ajax4jsf.request.MultipartRequest.getParameter(MultipartRequest.java:616)
at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:1152)
at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:1140)
at java.util.Collections$UnmodifiableMap.get(Collections.java:1282)
at org.ajax4jsf.context.AjaxContextImpl.decode(AjaxContextImpl.java:139)
at org.ajax4jsf.context.AjaxContext.getCurrentInstance(AjaxContext.java:210)
at org.ajax4jsf.application.AjaxViewHandler.createView(AjaxViewHandler.java:85)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:194)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:367)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.internalProcess(ActiveRequestResponseCacheValve.java:74)
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Header section is too big
at org.ajax4jsf.request.MultipartRequest$HeadersHandler.handle(MultipartRequest.java:266)
at org.ajax4jsf.request.ByteSequenceMatcher.findSequence(ByteSequenceMatcher.java:152)
at org.ajax4jsf.request.MultipartRequest.readHeader(MultipartRequest.java:305)
at org.ajax4jsf.request.MultipartRequest.readNext(MultipartRequest.java:207)
at org.ajax4jsf.request.MultipartRequest.getParam(MultipartRequest.java:551)
... 42 more

这是我当前的配置。

 <filter>
     <display-name>RichFaces Filter</display-name>
     <filter-name>richfaces</filter-name>
     <filter-class>org.ajax4jsf.Filter</filter-class>
     <init-param>
        <param-name>createTempFiles</param-name>
        <param-value>false</param-value>
     </init-param>
     <init-param>
        <param-name>maxRequestSize</param-name>
        <param-value>419430400</param-value>
     </init-param>  
 </filter>  
 <filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
 </filter-mapping>

如果文件大小小于150 Mb正常运行,我的应用程序将部署在jboss

1 个答案:

答案 0 :(得分:1)

我解决了,对于大文件应该使用临时文件夹

 <filter>
   <display-name>RichFaces Filter</display-name>
   <filter-name>richfaces</filter-name>
   <filter-class>org.ajax4jsf.Filter</filter-class>
   <init-param>
      <param-name>createTempFiles</param-name>
      <param-value>true</param-value>
   </init-param>
   <init-param>
   <param-name>maxRequestSize</param-name>
   <param-value>419430400</param-value>
   </init-param>  
 </filter>