title: Multipart, spring-boot and JBoss - Required request part 'file' is not present
body: <p>I have an application that uses <strong>spring-boot</strong> and embedded <strong>Tomcat</strong> for development, and on production server it is deployed on <strong>JBoss 6.4 EAP</strong>.
  After adding support for JBoss, multipart file upload stopped working. On both containers it was throwing <strong>MissingServletRequestPartException</strong>.</p>
  
  <p>Adding <em>MultipartConfigElement</em> to <em>ServletRegistrationBean</em> fixed this issue on tomcat, but for JBoss it's still not working. Do you have any ideas where is the problem?</p>
  
  <p>Configuration:</p>
  
  <pre><code>@Bean
  public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet, MultipartConfigElement
          multipartConfig) {
      ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet);
      registration.getUrlMappings().clear();
      registration.addUrlMappings("/*");
      registration.setMultipartConfig(multipartConfig);
      return registration;
  }
  </code></pre>
  
  <p>Endpoint:</p>
  
  <pre><code>@RequestMapping(method = POST)
  @ResponseBody
  public SomeResponse uploadFileWithComment(
      @RequestParam(value = "file") final MultipartFile file,
      @RequestParam(value = "comment") String comment) {
      ...
  }
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;RestServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;com.rebelek.Application&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextClass&lt;/param-name&gt;
              &lt;param-value&gt;
                  org.springframework.web.context.support.AnnotationConfigWebApplicationContext
              &lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;RestServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>