日期:2014-05-18  浏览次数:20807 次

Too many open files 报错信息
服务器配置:linux
服务:resin3.2   默认使用内存1024M


java.io.FileNotFoundException:   /www/tmp/digi/smallpic.properties   (Too   many   open   files)
                at   java.io.FileOutputStream.open(Native   Method)
                at   java.io.FileOutputStream. <init> (FileOutputStream.java:179)
                at   java.io.FileOutputStream. <init> (FileOutputStream.java:70)
                at   com.tom.webutil.refresh.manager.BuildFile.bulidFile(Unknown   Source)
                at   _jsp._pages._getpice__jsp._jspService(_getpice__jsp.java:134)
                at   com.caucho.jsp.JavaPage.service(JavaPage.java:60)
                at   com.caucho.jsp.Page.pageservice(Page.java:570)
                at   com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:159)
                at   org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)
                at   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
                at   com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
                at   org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
                at   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
                at   com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
                at   com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
                at   com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
                at   com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
                at   com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
                at   com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)
                at   com.caucho.util.ThreadPool.run(ThreadPool.java:425)
                at   java.lang.Thread.run(Thread.java:595)

------解决方案--------------------
这两天weblogic服务器一直无缘无故死掉.一查看是默认WEBAPP没有了.查看错误是too many open files 在网上找了半天终于有所收获,有如下解决方法:
1、ulimit -n 8196 加大linux最大打开文件数,不过这个试过好像不太管用.
2、echo "10240 " > /proc/sys/fs/file-max

第二种方法好像更管用。先试试看。。真不想重新编译linux内核

下面这个是晚上瞎转在网上看到的

以下适合redhat linux 2.4

Linux 内核有时会报告“Too many open files”,起因是 file-max 默认值(8096)太小。要解决这个问