Question : Windows program holding two handles to same file?

We have a Java program using Log4J to write to log files on a Windows 2003 Server.  Log4J is having problems renaming the file (as part of its normal daily rolling behavior), and we have tracked this down to a known bug that occurs when another program has a lock on the file.  

Using the Process Explorer tool from Microsoft, we found that only our Java program has a handle on the file in question.  

However, Process Explorer reports that the program has two handles on the same file.  Does anyone know if this is normal?  How can this occur?  Is it possible to get further info on the handles?  (Process Explorer just says the handles are held by the program, not what sort of lock is being held)  Would this be the cause of our problems?

Answer : Windows program holding two handles to same file?

We figured out the problem -- we had two Tomcat web contexts pointing to the same file path.  This effectively created duplicates of everything in our system, including two Log4J loggers pointing to the same log file.  So it was a configuration error on our part, not a programming error in Log4j

Unfortunately, we found this out just by analyzing our configuration -- we didn't find a tool that gave use more information than Process Explorer.  We didn't try WhoLockMe because we couldn't install something like that on the machine where the problem was occurring, and we couldn't reproduce the error on other machines.

Random Solutions  
 
programming4us programming4us