问题描述
我尝试升级到Java8.启动带有Java 7编译的.war文件的tomcat7服务器时,出现下面的神秘错误.
I tried upgrading to Java 8. When starting our tomcat7 server, with a Java 7-compiled .war file, I get the mysteriously error below.
我希望这行得通吗?这篇帖子指出,tomcat 7应该适用于1.6及更高版本.我不能说是Tomcat的罪魁祸首还是.war.切换出不同的Java版本:
Should I expect this to work? This post says tomcat 7 should work with 1.6 and up.I can't tell if Tomcat is to blame, or the .war. Switching out different Java versions I get:
- 已安装JDK 7.45-可以工作(用于编译.war的相同版本)
- 已安装JDK 7.55-失败如下
- 已安装JDK 8.05-失败,如下所示
是tomcat的罪魁祸首,还是.war?
Is tomcat to blame, or the .war?
Caused by: org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131)
at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2032)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1923)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1891)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1877)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1270)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
推荐答案
我在Tomcat 7.0.26中看到此错误.
I was seeing this error with Tomcat 7.0.26.
要回答您的问题,请怪Tomcat: https://issues.apache.org/bugzilla/show_bug.cgi?id=53735
To answer your question, Tomcat is to blame: https://issues.apache.org/bugzilla/show_bug.cgi?id=53735
我已将其升级到7.0.53版(根据链接的问题,此修复应在7.0.30及更高版本中进行.)
Upgrading to version 7.0.53 fixed it for me (according to the linked issue, the fix should be in 7.0.30 and later).
这篇关于org.apache.tomcat.util.bcel.classfile.ClassFormatException:常量池中的无效字节标记:15-Tomcat 7,JDK不兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!