title: File upload working under Jetty but not under Tomcat
body: <p>I have a web application with spring in which I do some file upload. Under eclipse, using Jetty (the maven plugin) it works perfectly. But when I deploy the application under Tomcat it does not and I get the following Exception :</p>
  
  <pre><code>org.springframework.web.bind.MissingServletRequestParameterException: Required org.springframework.web.multipart.MultipartFile parameter 'file' is not present
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseMissingParameterException(AnnotationMethodHandlerAdapter.java:545)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestParam(HandlerMethodInvoker.java:336)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:207)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:132)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
  </code></pre>
  
  <p>Here is my form :</p>
  
  <pre><code>&lt;form method="post" action="../admin/import.html" id="import"
      enctype="multipart/form-data"&gt;
      &lt;div id="importInmates" align="center"&gt;
          &lt;input type="file" name="file" id="file"
              data-dojo-type="dijit.form.Button"
              label="&lt;fmt:message key='import.file' /&gt;" /&gt;
          &lt;button data-dojo-type="dijit.form.Button" id="importInmates"
              type="submit"&gt;
              &lt;fmt:message key="import.import" /&gt;
          &lt;/button&gt;
      &lt;/div&gt;
      &lt;input type="hidden" name="importType" value="inmates" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And here is the intercepting method :</p>
  
  <pre><code>    @RequestMapping(value = IMPORT_PAGE, method = RequestMethod.POST)
  public String recieveFile(@RequestParam("importType") String importType,
          @RequestParam("file") MultipartFile multipartFile, final HttpSession session)
  {
      if (multipartFile.getSize() &lt; 0)
      {
          LOGGER.debug("No file has been uploaded");
          return "redirect:.." + IMPORT_PAGE;
      }
  
      File file = new File("tmp");
  
      try
      {
          multipartFile.transferTo(file);
          BufferedReader lec = new BufferedReader(new FileReader(file));
  
          LOGGER.debug(lec.readLine());
          lec.close();
  
      }
      catch (Exception e)
      {
          LOGGER.error("An exception occured while reading " + importType + " file", e);
      }
  
      return "redirect:.." + IMPORT_PAGE;
  }
  </code></pre>
  
  <p>I have added the following bean :</p>
  
  <pre><code>&lt;bean id="multipartResolver"
      class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
      &lt;property name="maxUploadSize" value="100000000"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>both in applicationContext.xml and mvc-servlet.xml even if I think that only the latter is important.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks.</p>