今天碰到个问题,jetty系统跑的时候点击页面突然报 internal server error 错,翻了一下日志,发现很多jsp not found的错误:
2013-11-28 04:29:16,500 WARN [SymmetricDS] [log] [1002316844@qtp-718123118-23] /xx/xx/xx/xx/xx/xx-wizard.do
org.apache.jasper.JasperException: PWC6117: File "/common/error.jsp" not found
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:89)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:375)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:169)
at org.apache.jasper.compiler.JspUtil.getInputStream(JspUtil.java:910)
at org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:143)
at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:376)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:210)
继续翻,看到一个可疑的地方:
2013-11-28 04:29:10,552 WARN [] [log] [1059039254@qtp-718123118-25] Nested in org.apache.jasper.JasperException: PWC6344: Unable to create output writer for file ../xx/WEB-INF/jspclasses/org/apache/jsp/common/error_jsp.java:
java.io.FileNotFoundException: ../xx/WEB-INF/jspclasses/org/apache/jsp/common/error_jsp.java (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 org.apache.jasper.compiler.JDTJavaCompiler.getJavaWriter(JDTJavaCompiler.java:149)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:188)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:435)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:360)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
看来是因为jetty进程打开文件数的限制,导致进程不能生成jsp页面到linux的文件系统里。
先ps aux |grep jetty 一下,找到jetty的pid,然后
lsof -u jettypid看一下当前用户的文件数是1286,
再查看一下当前用户级的可打开文件数: ulimit -a
默认是1024.
需要改大,更改 /etc/security/limits.conf,加入
soft nofile 65535
hard nofile 65535
本文出自 “祝坤荣” 博客,请务必保留此出处