javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8

Java.net JIRA | lutzulrich | 2 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    [JAVASERVERFACES-3765] FileRenderer decode fails on non multipart/form-data Ajax request - Java.net JIRA

    java.net | 10 months ago
    javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8
  2. 0

    {{com.sun.faces.renderkit.html_basic.FileRenderer.decode(FacesContext, UIComponent)}} fails if the content-type of the HTTP request is not ''multipart/form-data" and if the request does not submit a file. This is at least true for Tomcat, see stack trace below. The issue pops up when the form contains the {{h:inputFile}} along with some Ajax-enabled component, when no file has been selected and the Ajax request is with {{execute="@form"}}. In that case, the {{HtmlInputFile}} is decoded, but the submitted Ajax request is not a multipart (and contains no Part). I guess the solution would be to check if the submitted content type is multipart. PrimeFaces' file upload does this in its {{decode()}}: {{if(!context.getExternalContext().getRequestContentType().toLowerCase().startsWith("multipart/")) return;}} Feb 10, 2015 4:45:12 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError Schwerwiegend: javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8 at org.apache.catalina.connector.Request.parseParts(Request.java:2801) at org.apache.catalina.connector.Request.getParts(Request.java:2655) at org.apache.catalina.connector.RequestFacade.getParts(RequestFacade.java:1075) at com.sun.faces.renderkit.html_basic.FileRenderer.decode(FileRenderer.java:91) at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:831) at javax.faces.component.UIInput.decode(UIInput.java:771) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1226) at javax.faces.component.UIInput.processDecodes(UIInput.java:676) at javax.faces.component.UIForm.processDecodes(UIForm.java:225) at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:573) at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689) at javax.faces.component.UIForm.visitTree(UIForm.java:371) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403) at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:927) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8 at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:804) at org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:259) at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:283) at org.apache.catalina.connector.Request.parseParts(Request.java:2737) ... 41 more

    Java.net JIRA | 2 years ago | lutzulrich
    javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8
  3. 0

    {{com.sun.faces.renderkit.html_basic.FileRenderer.decode(FacesContext, UIComponent)}} fails if the content-type of the HTTP request is not ''multipart/form-data" and if the request does not submit a file. This is at least true for Tomcat, see stack trace below. The issue pops up when the form contains the {{h:inputFile}} along with some Ajax-enabled component, when no file has been selected and the Ajax request is with {{execute="@form"}}. In that case, the {{HtmlInputFile}} is decoded, but the submitted Ajax request is not a multipart (and contains no Part). I guess the solution would be to check if the submitted content type is multipart. PrimeFaces' file upload does this in its {{decode()}}: {{if(!context.getExternalContext().getRequestContentType().toLowerCase().startsWith("multipart/")) return;}} Feb 10, 2015 4:45:12 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError Schwerwiegend: javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8 at org.apache.catalina.connector.Request.parseParts(Request.java:2801) at org.apache.catalina.connector.Request.getParts(Request.java:2655) at org.apache.catalina.connector.RequestFacade.getParts(RequestFacade.java:1075) at com.sun.faces.renderkit.html_basic.FileRenderer.decode(FileRenderer.java:91) at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:831) at javax.faces.component.UIInput.decode(UIInput.java:771) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1226) at javax.faces.component.UIInput.processDecodes(UIInput.java:676) at javax.faces.component.UIForm.processDecodes(UIForm.java:225) at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:573) at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689) at javax.faces.component.UIForm.visitTree(UIForm.java:371) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403) at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:927) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8 at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:804) at org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:259) at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:283) at org.apache.catalina.connector.Request.parseParts(Request.java:2737) ... 41 more

    Java.net JIRA | 2 years ago | lutzulrich
    javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    using jsf2.2 with apache Tomcat , when adding <h:inputFile /> to form javax.servlet.ServletException:

    Stack Overflow | 1 year ago | Wael Elkholy
    javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded; charset=UTF-8
  6. 0

    using jsf2.2 with appach tomcat , when adding <h:inputFile /> to form javax.servlet.ServletException: - BlogoSfera

    co.uk | 1 year ago
    javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded; charset=UTF-8

  1. tomthomas 4 times, last 2 months ago
5 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException

    the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8

    at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>()
  2. org.apache.tomcat
    FileUploadBase.parseRequest
    1. org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:804)
    2. org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:259)
    3. org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:283)
    3 frames
  3. Glassfish Core
    RequestFacade.getParts
    1. org.apache.catalina.connector.Request.parseParts(Request.java:2737)
    2. org.apache.catalina.connector.Request.getParts(Request.java:2655)
    3. org.apache.catalina.connector.RequestFacade.getParts(RequestFacade.java:1075)
    3 frames
  4. JSF
    FileRenderer.decode
    1. com.sun.faces.renderkit.html_basic.FileRenderer.decode(FileRenderer.java:91)
    1 frame
  5. JavaEE 7
    UIForm.processDecodes
    1. javax.faces.component.UIComponentBase.decode(UIComponentBase.java:831)
    2. javax.faces.component.UIInput.decode(UIInput.java:771)
    3. javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1226)
    4. javax.faces.component.UIInput.processDecodes(UIInput.java:676)
    5. javax.faces.component.UIForm.processDecodes(UIForm.java:225)
    5 frames
  6. JSF
    PartialVisitContext.invokeVisitCallback
    1. com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:573)
    2. com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    2 frames
  7. JavaEE 7
    UIComponent.visitTree
    1. javax.faces.component.UIComponent.visitTree(UIComponent.java:1689)
    2. javax.faces.component.UIForm.visitTree(UIForm.java:371)
    3. javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    4. javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    4 frames
  8. JSF
    PartialViewContextImpl.processPartial
    1. com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403)
    2. com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266)
    2 frames
  9. JavaEE 7
    UIViewRoot.processDecodes
    1. javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:927)
    1 frame
  10. JSF
    LifecycleImpl.execute
    1. com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
    2. com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    3. com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    3 frames
  11. JavaEE 7
    FacesServlet.service
    1. javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    1 frame
  12. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    2 frames
  13. Tomcat WS
    WsFilter.doFilter
    1. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    1 frame
  14. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    7. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    8. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    9. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    10. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    10 frames
  15. Grizzly HTTP
    JIoEndpoint$SocketProcessor.run
    1. org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    3. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    3 frames
  16. Java RT
    ThreadPoolExecutor$Worker.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    2 frames
  17. Tomcat Util
    TaskThread$WrappingRunnable.run
    1. org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    1 frame
  18. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)
    1 frame