ITPub博客

首页 > 数据库 > Oracle > 解决WebLogic中Too many open files异常

解决WebLogic中Too many open files异常

Oracle 作者:perfychi 时间:2014-09-04 17:52:34 0 删除 编辑
From :http://oracleseeker.com/2009/09/29/weblogic_too_many_open_file/


解决WebLogic中Too many open files异常

九月 29, 2009 in Oracle 融合中间件

在经过近期的连续加班,项目最后阶段的开发终于完成,并于前天晚上顺利实施上线,上线后就凌晨2点钟了,虽然身体有些疲惫,心理却轻松了很多。可是没想到早晨来上班,刚走到客户公司楼下,就接到电话说正式环境的服务器当掉了,跑到楼上打开电脑下载正式环境的服务器日志,发现了如下异常信息:

 
<[weblogic.servlet.internal.WebAppServletContext@6c086c08 - appName: 'consoleapp', name: 'console', context-path: '/console', spec-version: '2.5'] Servlet failed with IOException 
java.io.FileNotFoundException: /***/wlserver_10.3/server/lib/consoleapp/webapp/images/sort_up.gif (Too many open files) 
    at java.io.FileInputStream.open(Native Method) 
    at java.io.FileInputStream.(FileInputStream.java:112) 
    at weblogic.utils.classloaders.FileSource.getInputStream(FileSource.java:31) 
    at weblogic.servlet.internal.WarSource.getInputStream(WarSource.java:65) 
    at weblogic.servlet.FileServlet.sendFile(FileServlet.java:400) 
    Truncated. see log file for complete stacktrace 
>


从日志本身可以发现“Too many open files”,说明同时打开的文件数过多,于是想起Linux/AIX操作系统中会有参数设置允许同时打开的最大文件数量,具体查看方法可以参考: 
http://hi.baidu.com/bluesnake/blog/item/d267e350019a85591138c2f2.html [postads250x250] 
而经过查看,在本项目正式环境中已经将允许同时打开的最大文件数量设置为了unlimited,所以应该不是服务器的原因,转而查看WebLogic的配置,猜测是由WebLogic的配置文件指定了部署在WebLogic上的应用允许同时打开的最大文件数量。 
首先查看startWebLogic.sh和setDomainEnv.sh,都没有发现类似设置,接下来查看WebLogic本身的配置commEnv.sh(***\wlserver_10.3\common\bin),发现如下内容:

?View Code TEXT
1
2
3
4
5
6
7
8
9
10
11
12
13
# limit the number of open file descriptors
resetFd() {
  if [ ! -n "`uname -s |grep -i cygwin || uname -s |grep -i windows_nt || \
              uname -s |grep -i HP-UX`" ]
  then
    maxfiles=`ulimit -H -n`
    if [ "$?" = "0" -a  `expr ${maxfiles} : '[0-9][0-9]*$'` -eq 0 ]; then
        ulimit -n 1024
    fi
  fi
}
……
resetFd

果然在该配置文件中指定了该数量,其默认值为1024,尝试将其改大,在网上查了下,在AIX4.3版本之后该值最大可以被设置为32768,于是我尝试将其改成了32768,重新启动WebLogic,正常被启动,且再未出现该异常:)

总结下来,该问题的解决方案如下:

在***\wlserver_10.3\common\bin\目录下找到commEnv.sh,修改其resetFd()函数的ulimit -n 后面的数值,根据操作系统不同系统适量调大,调整后的该函数应为

?View Code TEXT
1
2
3
4
5
6
7
8
9
10
resetFd() {
  if [ ! -n "`uname -s |grep -i cygwin || uname -s |grep -i windows_nt || \
              uname -s |grep -i HP-UX`" ]
  then
    maxfiles=`ulimit -H -n`
    if [ "$?" = "0" -a  `expr ${maxfiles} : '[0-9][0-9]*$'` -eq 0 ]; then
        ulimit -n 32768
    fi
  fi
}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27042095/viewspace-1263998/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-06-06

  • 博文量
    484
  • 访问量
    2975556