On Linux, creating FileHandler for mounted directory hangs ....

Hi,

On Linux, I try to create a FileHandler for a mounted directory and it hangs. Anyone knows why, please let me know.

Here is the code that I use. Suprisingly, it works for Windows for mounted directory.

public class NewFileHandle

{

public static void main (String[] args)

{

try

{

System.out.println("Before");

FileHandler custlogFileHandler = new FileHandler("/var/tmp/logs/custlog", true);

System.out.println("After");

}

catch (Exception e)

{

e.printStackTrace();

}

}

}

Regards,

Chintan

[617 byte] By [chintan13a] at [2007-10-3 3:54:00]
# 1

Sounds like the file is locked for write access. The FileHandler constructor probably won't return until the file is unlocked. Can you make FileHandler open the file read-only (won't work if custlog is locked exclusively, but that usually it's just a simple write lock)? Just guessing, mind you...

Brian

brian@cubik.caa at 2007-7-14 21:51:57 > top of Java-index,Core,Core APIs...
# 2

Hi Brian,

The file is not locked. Actually file does not exist there. This class should create a "custlog" file.

I also tried creating a file myself and changing the permissions to "777". But still it did not work.

When I run the same program for local directory, it works fine.

Is this a bug in java? I tried searching the bugs database, but could not find it.

Here is what I tried.

1) File does not exist at the given location:

root@base0-0-0-6-0-11-1:/opt/hss/log> export PATH=$PATH:/usr/local/java/jre1.5.0_04/bin/:

root@base0-0-0-6-0-11-1:/opt/hss/log> which java

/usr/local/java/jre1.5.0_04/bin/java

root@base0-0-0-6-0-11-1:/opt/hss/log> java NewFileHandle

Before

......... hangs here ...

2) File exist with "777" permissions

root@base0-0-0-6-0-11-1:/opt/hss> ls -l custlog

-rw-r--r-- 1 root root 0 Aug 31 09:46 custlog

root@base0-0-0-6-0-11-1:/opt/hss> chmod 777 custlog

root@base0-0-0-6-0-11-1:/opt/hss> cd log/

root@base0-0-0-6-0-11-1:/opt/hss/log> java NewFileHandle

root@base0-0-0-6-0-11-1:/opt/hss/log> java NewFileHandle

Before

......hangs here ....

Regards,

Chintan

chintan13a at 2007-7-14 21:51:57 > top of Java-index,Core,Core APIs...
# 3
You could make an strace to see more details what is going on. http://linuxhelp.blogspot.com/2006/05/strace-very-powerful-troubleshooting.html
BIJ001a at 2007-7-14 21:51:57 > top of Java-index,Core,Core APIs...