最近部署服务器时,老是会出现jvm fatal error 致使tomcat崩溃没法正常启动,如下是错误信息
java
# A fatal error has been detected by the Java Runtime Environment: windows
# tomcat
# Internal Error (c1_Optimizer.cpp:271), pid=1196, tid=4412 服务器
# guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp app
# eclipse
# JRE version: 6.0_25-b06 webapp
# Java VM: Java HotSpot(TM) Client VM (20.0-b11 mixed mode windows-x86 ) jvm
# If you would like to submit a bug report, please visit: jsp
# http://java.sun.com/webapps/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x01213800): JavaThread "C1 CompilerThread0" daemon [_thread_in_native, id=4412, stack(0x179f0000,0x17a40000)]
Stack: [0x179f0000,0x17a40000], sp=0x17a3f554, free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
这个问题在google上搜了不少文章,终于找到一片来自iteye网友的文章,和我遇到的问题基本相似,很是感谢。传送门:http://seanhe.iteye.com/blog/905997
问题的缘由就在于 显示JIT在作编译优化的时候处理 某个方法时出错。
本利的错误是这个方法
org.hibernate.cfg.annotations.SimpleValueBinder.setType
解决办法:让jvm跳过该方法的编译优化
在jvm启动参数中添加启动参数
-XX:CompileCommand=exclude,org/hibernate/cfg/annotations/SimpleValueBinder,setType
若是是eclipse下启动服务,则在eclipse-preference-java-installed jres 里面设置,
在 defalt vm arguments 填入上面的代码就能够了。
若是是直接经过startup 启动tomcat,则须要修改如下文件
Windows下,在文件/bin/catalina.bat,Unix下,在文件/bin/catalina.sh
找到
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%
修改成
set JAVA_OPTS=%JAVA_OPTS% -XX:CompileCommand=exclude,org/hibernate/cfg/annotations/SimpleValueBinder,setType %LOGGING_CONFIG%