Hello,

We are using Jetty Runner 9.4.8 to launch a Java web application from a WAR 
file and have encountered a problem with file uploads. The code in question 
works fine if the WAR file is launched by Tomcat, but fails if the WAR file is 
launched by Jetty Runner, which suggests that there may be a problem with the 
way in which we have configured Jetty Runner.

The application is written in Grails, which runs on Spring Boot, so we are 
using the Spring MultipartFile interface to upload the file. At the point at 
which the web application attempts to store a copy of the uploaded file in a 
local folder on the web server, we get a  “File not found exception”. This 
appears to be caused by the value of “java.io.tmpdir” being prepended to the 
target filename, which means that the path is invalid. Can anyone suggest why 
this might be happening? 

In more detail, the relevant line of code is

        uploader.transferTo(“/some/destination”)        // make a local copy of 
the file upload

and the exception is

        java.io.FileNotFoundException: /tmp/some/destination/file (No such file 
of directory)

Note that “/tmp” (or more precisely, the value of 
System.getProperty(“java.io.tmpdir”)) has been prepended to the destination 
pathname, which makes it invalid.

The problem seems to be with the implementation of the Spring MultipartFile 
interface on Jetty Launcher - I believe Spring Boot is using an implementation 
based on the Apache Commons File Upload package. Does anyone know of a reason 
why this might not work on Jetty?

Thanks for any help or suggestions.

Best wishes,

Robert

_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to