新电脑部署B2C项目,启动服务时报错如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (c1_Optimizer.cpp:271), pid=19800, tid=19896
# guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
#
# JRE version: 6.0_39-b04
# Java VM: Java HotSpot(TM) Client VM (20.14-b01 mixed mode windows-x86 )
# An error report file with more information is saved as:
# E:\WorkSpace\b2cCeshi\online\hs_err_pid19800.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 里面设置当前使用JDK点击Edit, 在 defalt vm arguments 填入下边的代码就可以了!
代码:
-XX:CompileCommand=exclude,org/hibernate/cfg/annotations/SimpleValueBinder,setType
2.如果直接在外部启动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%
参考资料:
http://seanhe.iteye.com/blog/905997
http://eric-flower.iteye.com/blog/1447080
http://sind.iteye.com/blog/1132459