最近部署服務器時,老是會出現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%