Hello, > About the methods i use in the application along with file.delete() (which is > what this post is about) I use File[] files = new > File("C:\\SomeFolder").listFiles(); > file.getName(); > file.lastModified() > Path path = Paths.get(fileName); > Would any of these cause the lock on the file ?
They don't look suspicious to me. What you could do is, use the debugger to go step by step. In parallel, use the ProcessExplorer to see at which point the file handle appears. Maybe it is more hidden in some other routines which might use a MappedByteBuffer to read or write. > > Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH) > <thomas.hoffm...@speed4trade.com.invalid> a écrit : > > > > > > -----Ursprüngliche Nachricht----- > > > Von: Martin Moore <martinmoore...@gmail.com> > > > Gesendet: Sonntag, 9. Oktober 2022 15:37 > > > An: thomas.hoffm...@speed4trade.com.invalid; Tomcat Users List > > > <users@tomcat.apache.org> > > > Betreff: Re: About granting permissions to Tomcat JVM > > > > > > the ProcessExplorer shows that a Java process is running on the file > > > and > > this > > > only after actually performing the delete from Java. > > > > > > Some possibilities for file locking. > > - the upload process didn’t close the streams properly > > - You use http2 and sendfile > > - You are using a MappedByteBuffer before deletion: > > https://bugs.openjdk.org/browse/JDK-4724038 > > > > ... just some ideas which cause file locking ... > > > > > Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH) > > > <thomas.hoffm...@speed4trade.com.invalid> a écrit : > > > > > > > Hello, > > > > this might be a behavior of the underlying OS. > > > > If the file is locked, it is marked for deletion and when the file > > > > lock is released, the file is physically deleted. > > > > > > > > Maybe you can check with ProcessExplorer from MS whether there is > > > > an open file handle on this file. > > > > > > > > Greetings, > > > > Thomas > > > > > > > > > -----Ursprüngliche Nachricht----- > > > > > Von: Martin Moore <martinmoore...@gmail.com> > > > > > Gesendet: Sonntag, 9. Oktober 2022 09:56 > > > > > An: Tomcat Users List <users@tomcat.apache.org>; > > > > > ma...@apache.org > > > > > Betreff: Re: About granting permissions to Tomcat JVM > > > > > > > > > > Hello Mark, > > > > > > > > > > I don't know if the SecurityManager is enabled or not (how to > > > > > disable it > > > > > btw?) > > > > > I set the env var CATALINA_HOME to be C:/Program > > > > > Files/Apache-Tomcat-8/ The files in question are stored in > > > > > Desktop/SomeFolder > > > > > > > > > > Thanks. > > > > > > > > > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a > > > > > écrit > > : > > > > > > > > > > > On 08/10/2022 17:36, Martin Moore wrote: > > > > > > > Hello, > > > > > > > > > > > > > > I am facing a problem using Tomcat V8 with my J2ee app that > > > > > > > deletes > > > > > > (using > > > > > > > file.delete() Java 8) a file from disk (Windows). The file > > > > > > > is actually deleting only on application level meaning that > > > > > > > the application does not see the file anymore but if i open > > > > > > > the folder i still see the file which > > > > > > is > > > > > > > then locked by Java process. I only get the file to be > > > > > > > removed physically when i close the Tomcat instance. > > > > > > > > > > > > > > Does this problem relate to permissions in catalina.policy ? > > > > > > > > > > > > Unlikely. > > > > > > > > > > > > Are you using a SecurityManager? > > > > > > > > > > > > > How to solve this? > > > > > > > > > > > > Where, exactly, are you storing these files? Where, exactly, > > > > > > are CATALINA_HOME and CATALINA_BASE? > > > > > > > > > > > > Mark > > > > > > > > > > > > -------------------------------------------------------------- > > > > > > ---- > > > > > > --- To unsubscribe, e-mail: > > > > > > users-unsubscr...@tomcat.apache.org > > > > > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------ > > > > --- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org