Tomcat啟動:A fatal error has been detected by the Java Runtime Environment(JVM Crash分析及相關資料)
阿新 • • 發佈:2019-02-19
2013年1月10號注:
今天更新程式碼之後,突然出現一個問題:Tomcat啟動時,總是會出現jvm fatal error錯誤導致tomcat無法正常啟動,以下是錯誤資訊:
# # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (c1_Optimizer.cpp:271), pid=6048, tid=5404 # guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp # # JRE version: 6.0_29-b11 # Java VM: Java HotSpot(TM) Client VM (20.4-b02 mixed mode windows-x86 ) 2013-01-10 13:47:34,671 INFO hibernate.cfg.AnnotationBinder:419 -> Binding entity from annotated class: com.estone.www.spis.model.po.zd.sys.DPossession 2013-01-10 13:47:34,671 INFO cfg.annotations.EntityBinder:422 -> Bind entity com.estone.www.spis.model.po.zd.sys.DPossession on table d_possession 2013-01-10 13:47:34,671 INFO hibernate.cfg.AnnotationBinder:419 -> Binding entity from annotated class: com.estone.www.spis.model.po.zd.writ.DWritTemplate 2013-01-10 13:47:34,671 INFO cfg.annotations.EntityBinder:422 -> Bind entity com.estone.www.spis.model.po.zd.writ.DWritTemplate on table d_writ_template 2013-01-10 13:47:34,671 INFO hibernate.cfg.AnnotationBinder:419 -> Binding entity from annotated class: com.estone.www.spis.model.po.zd.writ.DWritType 2013-01-10 13:47:34,671 INFO cfg.annotations.EntityBinder:422 -> Bind entity com.estone.www.spis.model.po.zd.writ.DWritType on table d_writ_type # An error report file with more information is saved as: # D:\Program Files\apache-tomcat-6.0.20\bin\hs_err_pid6048.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp #
在網上搜尋好久,終於找到了類似錯誤,網上解釋歸結於:JIT在做編譯優化的時候處理時出錯,可能是觸發了JVM的編譯器的BUG導致的。幸好SUN(Oracle)提供了相關的文件說明,得以讓我們解決了這個問題。
文件地址:http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyzu
在這裡,導致本次錯誤的是這個方法:
org.hibernate.cfg.annotations.SimpleValueBinder.setType
解決辦法:讓jvm跳過該方法的編譯優化
1.如果是eclipse下啟動服務,則在myeclipse-preference-java-installed
jres 裡面設定, 在 defalt vm arguments 填入下邊的程式碼就可以了!如圖:
程式碼:
-XX:CompileCommand=exclude,org/hibernate/cfg/annotations/SimpleValueBinder,setType
選擇使用的JRE,,點選編輯edit
將上邊程式碼貼上到此處,OK
2.如果是直接通過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%
如圖:
參考資料:感謝以下連結的朋友