title: FileNotFoundException while uploading multi part file - Spring boot
body: <p>I am trying to upload the file via Multi part upload of spring boot application. While uploading the file, jetty throws FileNotFound Exception.</p>
  
  <p>Following is the model structure:</p>
  
  <pre><code>private String identifier;
  private MultipartFile file;
  </code></pre>
  
  <p>Following is the config:</p>
  
  <pre><code>@Bean
  public MultipartConfigElement multipartConfigElement() {
      MultipartConfigFactory factory = new MultipartConfigFactory();
      factory.setMaxFileSize("500MB");
      factory.setMaxRequestSize("500MB");
      return factory.createMultipartConfig();
  }
  
  @Bean
  public CommonsMultipartResolver multipartResolver() {
      return new CommonsMultipartResolver();
  }
  </code></pre>
  
  <p>Following call throws the exception:</p>
  
  <pre><code>model.getFile().getInputStream()
  </code></pre>
  
  <p>Below is the stack trace:</p>
  
  <pre><code>java.io.FileNotFoundException: /tmp/MultiPart7953817223010764667 (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146)
      at org.eclipse.jetty.util.MultiPartInputStream$MultiPart.getInputStream(MultiPartInputStream.java:218)
      at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile.getInputStream(StandardMultipartHttpServletRequest.java:253)
  //user classes
  </code></pre>
  
  <p>This issue is intermittent and I am not able to re-produce it with consecutive attempts. Same file gets uploaded successfully for the second time.</p>
  
  <p>Any idea what I am doing wrong here?</p>
  
  <p>Thanks in advance</p>