gpt4 book ai didi

java - Tomcat 7 启动Web App失败并抛出java.lang.RuntimeException : Illegal type for StackMapType: -89

转载 作者:行者123 更新时间:2023-12-01 13:31:11 25 4
gpt4 key购买 nike

我有一个使用 JDK 1.7 构建 jar 文件的 Web 应用程序。我将它部署在 Tomcat 7 上,它在启动时抛出了这个异常。

SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1664)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: Illegal type for StackMapType: -89
at org.apache.tomcat.util.bcel.classfile.StackMapType.setType(StackMapType.java:73)
at org.apache.tomcat.util.bcel.classfile.StackMapType.<init>(StackMapType.java:65)
at org.apache.tomcat.util.bcel.classfile.StackMapType.<init>(StackMapType.java:52)
at org.apache.tomcat.util.bcel.classfile.StackMapEntry.<init>(StackMapEntry.java:55)
at org.apache.tomcat.util.bcel.classfile.StackMap.<init>(StackMap.java:73)
at org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute(Attribute.java:145)
at org.apache.tomcat.util.bcel.classfile.Code.<init>(Code.java:85)
at org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute(Attribute.java:126)
at org.apache.tomcat.util.bcel.classfile.FieldOrMethod.<init>(FieldOrMethod.java:58)
at org.apache.tomcat.util.bcel.classfile.Method.<init>(Method.java:72)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:268)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:128)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2101)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1977)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1943)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1928)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1322)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
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:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more

我使用了反复试验的方法,发现我为应用程序构建的 jar 文件导致了问题。我在网上搜索了一下,有人提到这可能与Java编译代码的版本和Java运行时有关。

最佳答案

从这篇文章得到提示后" http://marc.info/?l=tomcat-user&m=137183130517812&w=2

Christopher Schultz wrote: "I would expect this kind of thing if you used a current BCEL against a newer .class file generated for example by Java 8, which BCEL might not yet support (or at least the version Tomcat uses)."

我检查了 POM 文件以及 Eclipse 中的项目属性。

我注意到,尽管我使用的是 JDK 1.7,但 Eclipse 正在编译 1.5 的代码,因为我忘记在

设置正确的编译设置

Project properties -> Java Compiler-> JDK Compliance

我将其从 1.5 更改为 1.7 并构建了 jar 文件,一切正常。 :-)

关于java - Tomcat 7 启动Web App失败并抛出java.lang.RuntimeException : Illegal type for StackMapType: -89,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21561080/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com