wood burning stoves*
The moose likes I/O and Streams and the fly likes Application down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Application down" Watch "Application down" New topic
Author

Application down

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 166
Respected Sir,

I am working in a web application(java 1.4/jsp/struts/postgres/linux/tomcat).Some times our server is going to down. While checking the logs we commonly got the following exception.
--------------------
java.io.FileNotFoundException: /opt/test/logs/test01082008.log (Too many open files)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
..............
We are writing the logs in files like "test01082008.log". I am not sure the
'PrintStream' object is closed each time after writing. We are creating the PrintStream object using "new PrintStream(
new BufferedOutputStream(
new FileOutputStream("filename",true))).

Please let me know what may be the cause of this types of exception.Is it related to PrintStream closing problem, or it related to tomcat or operating system or any other reason.

Thanks
Francis
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

The error is quite clear: you have too many open file handles. You should really close all streams / readers / writers when you're done with them. Always.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Application down
 
Similar Threads
Tomcat Hangs during startup
Tomcat4.1.24 not working as a NT service??
tomcat log file!!
error in deployment
Problem with Tomcat installation