General discussion

Locked

Too many open files Error in java

By mathew_t ·
Hi,

I have a java application running on Solaris 2.6 that works fine for a while and then craps out with the following error:

java.io.FileNotFoundException: /tmp/jlaunch.malettd.com.gcm.UPL.UPLMain.props (Too many open files)
java.io.FileNotFoundException: /tmp/jlaunch.malettd.com.gcm.UPL.UPLMain.props (Too many open files)
thr_continue of 0xd42702f8(0) failed: 3 = ESRCH.

At other times I get the following error message:

thr_continue of 0xd543fac8(3) failed: 3 = ESRCH.
thr_continue of 0xd543fa30(-278136652) failed: 3 = ESRCH.
thr_continue of 0xd543f990(-278136652) failed: 3 = ESRCH.
thr_continue of 0xd543fb30(-716965000) failed: 3 = ESRCH.
thr_continue of 0xd543fa78(-716965184) failed: 3 = ESRCH.
thr_continue of 0xd543fb78(0) failed: 3 = ESRCH.
Bus Error
si_signo [10]: Bus Error
si_errno [0]: Error 0
si_code [1]: BUS_ADRALN [addr: 0x3]

stackpointer=D3E21678

This happens even though the limit of the file descriptors is set to 256.

Iam a new java developer, so I am having trouble figuring out what is causing this problem.

Please help.

Thanks.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Too many open files Error in java

by JP107 In reply to Too many open files Error ...

I haven't encountered this error personally, but my first response would be to make sure that you are calling close() on all your FileInputStream's and FileOutputStream's that deal with your files. I believe it's the open streams that consume file descriptor resources.

The best way (in my opinion) to ensure that your streams are closed is by enclosing the call to the close() method in a finally block, as follows:

FileInputStream fis = null;
try {
<assign fis to file and use appropriately>
} <catch any necessary exceptions>
} finally{
try {
fis.close();
} catch (IOException ioe) {
// squelch this exception: nothing you
// can really do about it here.
}
}

Hope this helps

Collapse -

Too many open files Error in java

by mathew_t In reply to Too many open files Error ...

The question was auto-closed by TechRepublic

Collapse -

Too many open files Error in java

by diva_cen2000 In reply to Too many open files Error ...

hi,

i think ur trying to read file.The exception u have encountered will araised only when the file
ur trying to read is not in the current directory.

while ur trying to read a file u have to specify the directory,the path where the file is located.
if the file is in the same directory no problem.

eg.
consider the file ai.txt is in the directory
c:\windows
or so ..
and ur working in the same directory no need to give the path.
i.e
FileInputStream fin=new FileInputStream("a1.txt")

else
FileInputStream fin=new FileInputStream("c:\windows\a1.txt")
try this out ..

Collapse -

Too many open files Error in java

by mathew_t In reply to Too many open files Error ...

The question was auto-closed by TechRepublic

Collapse -

Too many open files Error in java

by diva_cen2000 In reply to Too many open files Error ...

hi,

i think ur trying to read file.The exception u have encountered will araised only when the file
ur trying to read is not in the current directory.

while ur trying to read a file u have to specify the directory,the path where the file is located.
if the file is in the same directory no problem.

eg.
consider the file ai.txt is in the directory
c:\windows
or so ..
and ur working in the same directory no need to give the path.
i.e
FileInputStream fin=new FileInputStream("a1.txt")

else
FileInputStream fin=new FileInputStream("c:\windows\a1.txt")
try this out ..

Collapse -

Too many open files Error in java

by mathew_t In reply to Too many open files Error ...

The question was auto-closed by TechRepublic

Collapse -

Too many open files Error in java

by mathew_t In reply to Too many open files Error ...

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums