File element in parameter 'null' already exists: in Wildfly deployment

706 Views Asked by At

I have deployed my code on Wildfly app server. I am using MultipartFile's transferTo() to transfer the uploaded zip file to destination location.

MultipartFile.transferTo(File);

I am getting following exception :

File element in parameter 'null' already exists: 'E:\\\\JBoss\\wildfly-16.0.0_9090_9191\\\\standalone\\\\deployments\\\\MyWar.war\\\\My_Export.zip'
at org.apache.commons.io.FileUtils.requireAbsent(FileUtils.java:2587)
at deployment.MyWar.war//org.apache.commons.io.FileUtils.moveFile(FileUtils.java:2305)
at deployment.MyWar.war//org.apache.commons.io.FileUtils.moveFile(FileUtils.java:2283)
at deployment.MyWar.war//org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:405)
at deployment.MyWar.war//org.springframework.web.multipart.commons.CommonsMultipartFile.transferTo(CommonsMultipartFile.java:168)

As per the javadoc, if file already exists transferTo() will delete it. When I debug the code, file.delete() is returning 'true' and file.exists() is also returning 'true'.

Note : Above code is properly working on tomcat 8.5.

spring-web : 5.3.23

commons-io : 2.11

commons-fileupload : 1.4

0

There are 0 best solutions below