jsp 文件太大导致 java 服务器 crash
碰到这样一个问题,访问普通的jsp程序,居然导致Java服务器 Crash 死掉:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_PRIV_INSTRUCTION (0xc0000096) at pc=0x00b024b1, pid=692, tid=5476
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode)
# Problematic frame:
# j jsp_servlet._web_45_inf._pages._be._change.__be_modify_info_start._jspService (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+1026
#
--------------- T H R E A D ---------------
Current thread (0x54892008): JavaThread "[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon [_thread_in_Java, id=5476]
siginfo: ExceptionCode=0xc0000096
Registers:
EAX=0xffffffff, EBX=0x00000071, ECX=0x00038490, EDX=0x00000000
ESP=0x558be594, EBP=0x558be5e4, ESI=0x4cd46ad6, EDI=0x558beb44
EIP=0x00b024b1, EFLAGS=0x00010216
Top of Stack: (sp=0x558be594)
0x558be594: 558beb44 4cd46ad6 558be5e4 558be5b4
0x558be5a4: 00000071 00000279 4cd58fa8 00000000
0x558be5b4: 00b024ab 6d7f5358 08a20c58 08a20c58
0x558be5c4: 03dacf30 558be5c8 4cd46852 558beb44
0x558be5d4: 4cd6e328 00000000 4cd58fa8 558beb3c
0x558be5e4: 558beb64 00b02923 00000000 00000000
0x558be5f4: 00000000 00000000 00000000 00000000
0x558be604: 00000000 00000000 00000000 00000000
Instructions: (pc=0x00b024b1)
0x00b024a1: 68 58 53 7f 6d e8 00 00 00 00 60 e8 15 7b bb 6c
0x00b024b1: f4 90 90 00 00 00 00 00 00 00 00 00 00 00 00 80
Stack: [0x55880000,0x558c0000), sp=0x558be594, free space=249k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
j jsp_servlet._web_45_inf._pages._be._change.__be_modify_info_start._jspService (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+1026
j weblogic.servlet.jsp.JspBase.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+9
j weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run()Ljava/lang/Object;+43
原来是该jsp文件太大,因为编译后的_jspService 方法 jsp_servlet._web_45_inf._pages._be._change.__be_modify_info_start._jspService 超过了Java语言规定的方法最大64k 大小。
you can extract those tables into another JSP and be included via <jsp:include />. This will cut away the binary size of that table within the service method. Do not use <% @ include %>, which still compiled the jsps into service method.
comment away
<jsp-param>
<param-name>jspServlet</param-name>
<param-value>weblogic.servlet.WlwJSPServlet</param-value>
</jsp-param>
in weblogic.xml
to use back default jspc jsp compiler. Default jspc jsp compiler is more tolerance to errors and you can even use "keepgenerated" <param> tag to generate java source, which is very useful to re-factor out tables.
Strive to put code/logics into java method or <%! %> region, this cut down the size of service() method.
http://futuretask.blogspot.com/2005/01/java-tip-5-avoid-64kb-method-limit-on.html
http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#88659