Multipart Configuration for JBoss Enterprise Application Platform/Application Server

Spring REST controller on Spring Boot (1.12) was not accepting multi-part requests for file upload on JBoss EAP/AS but working on Embedded Tomcat.

org.springframework.web.bind.MissingServletRequestParameterException: Required MultipartFile parameter 'file' is not present

I needed to add a multipart filter on my web xml configuration in Java

public class Application extends SpringBootServletInitializer {

 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
 return application.sources(Application.class);

 public void onStartup(ServletContext servletContext) throws ServletException {
 WebApplicationContext context = createRootApplicationContext(servletContext);
 ServletRegistration.Dynamic servletRegistration = servletContext.addServlet("dispatcher", new DispatcherServlet(context));
 servletRegistration.addMapping("/*"); // required JBOSS EAP
 servletRegistration.setMultipartConfig(getMultiPartConfig()); // fixes multipart requests

 private MultipartConfigElement getMultiPartConfig() {
 String location = "";
 long maxFileSize = -1;
 long maxRequestSize = -1;
 int fileSizeThreshold = 0;
 return new MultipartConfigElement(

 public static void main(String[] args) {, args);

My Spring and web.xml is configured via Java annotations.

I found this post for this configuration:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s