On 13.04.23 22:40, William L. Cunningham wrote:
Environment:  Windows 2019 Standard with latest JDK 17 and Apache Tomcat 8.5.87.

When trying to upload a file to the application running off Tomcat (custom 
software), we are getting the following error since 8.5.85 (works fine on 
8.5.84).

ERROR [2023-04-13 15:20:20]: 
com.company.dataimporter.servlet.FileUpload::doPost::85 Cannot delete 
C:\Program Files\Apache Software Foundation\Tomcat 
8.5_Tomcat_Prod\work\Catalina\localhost\company\upload_1da07be9_7508_44d3_aee6_28d1d7989727_00000000.tmp
java.lang.IllegalStateException: Cannot delete C:\Program Files\Apache Software 
Foundation\Tomcat 
8.5_Tomcat_Prod\work\Catalina\localhost\company\upload_1da07be9_7508_44d3_aee6_28d1d7989727_00000000.tmp
      at 
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.delete(DiskFileItem.java:428)
 ~[tomcat-coyote.jar:8.5.87]

This same procedure works perfectly fine in 8.5.84.  It was something 
introduced with 8.5.85.  It also works fine on a Linux hosted version (Centos) 
for 8.5.84 and above.  So it appears to be Windows centric.

When I watch the procedure in the Catalina\localhost\company folder on 8.5.84, 
I see the tmp file generated and then immediately deleted (it's a small 
upload).  On 8.5.85 and above, it's locked and can't be deleted.  Thus causing 
the error.


You should not install Tomcat in "C:\Program Files", or at least not run it there (e.g. run it with CATALINA_BASE != CATALINA_HOME): Windows protects the content of "C:\Program Files\*" in some ways that I can't detail - it might very well interfere in the way that you describe. Maybe you had installed/run it from another directory earlier, and that was changed with the upgrade?

Olaf


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to