问题描述
我尝试升级到 Java 8.当使用 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 不兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!