2 Replies Latest reply on May 28, 2017 6:16 AM by Adrian Boangiu

    Desperately need halp with multipart forms in Wildfly 10.1

    Adrian Boangiu Newbie

      Hello,

      I have already reported that we cannot post multipart forms in Wildfly 10.1 in the thread java.io.EOFException when using Multipart form-data.

       

      Since I didn’t receive any valuable information I have created the simplest possible application test.war (using the same technology as we use in our application, ADF Faces and Trinidad) to demonstrate the problem and to allow someone to debug a simple test case. I have attached the application in the archive test.war.zip that I had to split since the limit of uploaded files is 15MB.

       

      The JSF version we use is 2.1.7 and it is deployed as a Wildfly module. The necessary files to do it can be found inside the attached archive modules.zip.

       

      The following examples:

      1. AdfFaces.xhtml – demonstrates a simple ADF Faces multipart form containing only a submit button
      2. Trinidad.xhtml – demonstrates a simple Trinidad multipart form containing only a submit button
      3. AdfInputFile.xhtml – demonstrates a simple ADF Faces multipart form containing only an inputFile

      fail with the same exception when the form is submitted:

       

      14:08:57,354 SEVERE [org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl] (default task-47) : java.io.EOFException

              at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._readLine(MultipartFormHandler.java:253) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._readLine(MultipartFormHandler.java:237) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._skipBoundary(MultipartFormHandler.java:223) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.<init>(MultipartFormHandler.java:102) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.<init>(MultipartFormHandler.java:75) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl.beginRequest(FileUploadConfiguratorImpl.java:139) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:732) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:227) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:181) [trinidad-impl.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) [trinidad-api.jar:2.1.1 (custom: 12.1.3.0.41.140521.1008)]

              at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.server.handlers.MetricsHandler.handleRequest(MetricsHandler.java:62) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.core.MetricsChainHandler.handleRequest(MetricsChainHandler.java:59) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.servlet.handlers.ServletInitialHandler$1$1.run(ServletInitialHandler.java:110) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_92]

              at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:107) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805) [undertow-core-1.4.0.Final.jar:1.4.0.Final]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_92]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_92]

              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_92]

       

      Needless to say that everything work perfectly in JBoss 7.1.1 (and in Tomcat) and that a straight form using enctype="multipart/form-data" works in Windfly 10.1. That shows that the ADF Faces / Trinidad layerfor multipart forms does not work with undertow.

      As I have already signaled in the previous post, we have observed that in the method org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._skipBoundary called from the following piece of code:

      public MultipartFormHandler(final String type, final InputStream in) throws IOException

      {

      if (!type.startsWith(_MULTIPART_REQUEST_TYPE))

      {

      throw new IllegalStateException(_LOG.getMessage( "CONTENT_NOT_MULTIPART_FORM_DATA"));

      }

       

      _boundary = _parseBoundary(type);

      _in = new BufferedInputStream(in);

      _skipBoundary();

      }

      the InputStream in contains the full text of the http request in JBoss (and Tomcat) and is empty in Wildfly.

       

      We desperately need help to overturn this behavior since all the forms of our application are Adf faces multipart forms (usesUpload="true"). Is there something we can do at the level of undertow?

       

      Thank you for your help

      Adrian Boangiu