jvm crash 的缘由及解决办法

最近部署服务器时,老是会出现jvm fatal error 致使tomcat崩溃没法正常启动,如下是错误信息 
java

Java代码  收藏代码web

  1. # A fatal error has been detected by the Java Runtime Environment:  windows

  2. #  tomcat

  3. #  Internal Error (c1_Optimizer.cpp:271), pid=1196, tid=4412  服务器

  4. #  guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp  app

  5. #  eclipse

  6. # JRE version: 6.0_25-b06  webapp

  7. # Java VM: Java HotSpot(TM) Client VM (20.0-b11 mixed mode windows-x86 )  jvm

  8. # If you would like to submit a bug report, please visit:  jsp

  9. #   http://java.sun.com/webapps/bugreport/crash.jsp  

  10. #  

  11.   

  12. ---------------  T H R E A D  ---------------  

  13.   

  14. Current thread (0x01213800):  JavaThread "C1 CompilerThread0" daemon [_thread_in_native, id=4412, stack(0x179f0000,0x17a40000)]  

  15.   

  16. Stack: [0x179f0000,0x17a40000],  sp=0x17a3f554,  free space=317k  

  17. Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)  



这个问题在google上搜了不少文章,终于找到一片来自iteye网友的文章,和我遇到的问题基本相似,很是感谢。传送门:http://seanhe.iteye.com/blog/905997 

问题的缘由就在于 显示JIT在作编译优化的时候处理 某个方法时出错。 
本利的错误是这个方法 

Java代码  收藏代码

  1. org.hibernate.cfg.annotations.SimpleValueBinder.setType  



解决办法:让jvm跳过该方法的编译优化 

在jvm启动参数中添加启动参数 

Java代码  收藏代码

  1. -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 
找到 

Java代码  收藏代码

  1. set JAVA_OPTS=%JAVA_OPTS%  %LOGGING_CONFIG%  



修改成 

Java代码  收藏代码

  1. set JAVA_OPTS=%JAVA_OPTS% -XX:CompileCommand=exclude,org/hibernate/cfg/annotations/SimpleValueBinder,setType %LOGGING_CONFIG%  

相关文章
相关标签/搜索