java.lang.IllegalArgumentException: 不支持 class 文件主要版本 58
java.lang.IllegalArgumentException: Unsupported class file major version 58
我已经将 TomEE 包含在 Eclipse 中,以便开始开发动态 Web 项目(我还是新手)。
在将项目添加到TomEE服务器之前,我可以毫无问题地启动它。
但是当我将项目添加到服务器并尝试 运行 它时,我收到错误消息:java.lang.IllegalArgumentException: Unsupported class file major version 58
为了解决这个问题我尝试做的事情:
- 更改服务器端口号
- 删除并重新创建服务器
- 检查
web.xml
文件以确保 servlet 映射正常
- 重新配置项目的目标运行时间
- 重新配置 运行eclipse 的时间环境
版本:
- TomEE:v8.0.3 羽
- JDK: 15.0.1
- 日食:4.17.0
测试项目代码
TestServlet.java
package my.test.project;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("Hello this is a test");
out.close();
}
}
Web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>my.test.project.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
执行后控制台日志出错
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2363)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5052)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:886)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:233)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
... 33 more
Caused by: java.lang.RuntimeException: Unable to read class definition for my.test.project.TestServlet
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 35 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 58
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:195)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:176)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:162)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:283)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
... 42 more
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2363)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5052)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:886)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:233)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
... 33 more
Caused by: java.lang.RuntimeException: Unable to read class definition for my.test.project.TestServlet
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 35 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 58
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:195)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:176)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:162)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:283)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
... 42 more
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
... 13 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2363)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5052)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:886)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:233)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
... 33 more
Caused by: java.lang.RuntimeException: Unable to read class definition for my.test.project.TestServlet
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 35 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 58
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:195)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:176)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:162)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:283)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
... 42 more
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke
INFO: Stopping service [Catalina]
Nov 06, 2020 1:06:18 PM org.apache.openejb.server.SimpleServiceManager stop
INFO: Stopping server services
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke
INFO: Destroying ProtocolHandler ["http-nio-8080"]
项目方面
非常感谢您的帮助,因为我已经使用了很长时间,但似乎无法弄清楚问题所在。
谢谢。
您提到您的版本是 JDK: 15.0.1
项目的 Java Facet 是 14.
仅供参考:
- Java 13 使用主要版本 57
- Java 14 使用主要版本 58
- Java 15 使用主要版本 59
- Java 16 使用主版本 60
可以通过以下方式检查版本:
javap -verbose MyClass | grep "major"
我已经将 TomEE 包含在 Eclipse 中,以便开始开发动态 Web 项目(我还是新手)。
在将项目添加到TomEE服务器之前,我可以毫无问题地启动它。
但是当我将项目添加到服务器并尝试 运行 它时,我收到错误消息:java.lang.IllegalArgumentException: Unsupported class file major version 58
为了解决这个问题我尝试做的事情:
- 更改服务器端口号
- 删除并重新创建服务器
- 检查
web.xml
文件以确保 servlet 映射正常 - 重新配置项目的目标运行时间
- 重新配置 运行eclipse 的时间环境
版本:
- TomEE:v8.0.3 羽
- JDK: 15.0.1
- 日食:4.17.0
测试项目代码
TestServlet.java
package my.test.project;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("Hello this is a test");
out.close();
}
}
Web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>my.test.project.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
执行后控制台日志出错
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2363)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5052)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:886)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:233)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
... 33 more
Caused by: java.lang.RuntimeException: Unable to read class definition for my.test.project.TestServlet
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 35 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 58
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:195)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:176)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:162)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:283)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
... 42 more
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2363)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5052)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:886)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:233)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
... 33 more
Caused by: java.lang.RuntimeException: Unable to read class definition for my.test.project.TestServlet
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 35 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 58
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:195)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:176)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:162)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:283)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
... 42 more
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
... 13 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2363)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5052)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module TestProject: Unable to read class definition for my.test.project.TestServlet
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:886)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:233)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
... 33 more
Caused by: java.lang.RuntimeException: Unable to read class definition for my.test.project.TestServlet
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 35 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 58
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:195)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:176)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:162)
at org.apache.xbean.asm7.ClassReader.<init>(ClassReader.java:283)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
... 42 more
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke
INFO: Stopping service [Catalina]
Nov 06, 2020 1:06:18 PM org.apache.openejb.server.SimpleServiceManager stop
INFO: Stopping server services
Nov 06, 2020 1:06:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke
INFO: Destroying ProtocolHandler ["http-nio-8080"]
项目方面
非常感谢您的帮助,因为我已经使用了很长时间,但似乎无法弄清楚问题所在。
谢谢。
您提到您的版本是 JDK: 15.0.1 项目的 Java Facet 是 14.
仅供参考:
- Java 13 使用主要版本 57
- Java 14 使用主要版本 58
- Java 15 使用主要版本 59
- Java 16 使用主版本 60
可以通过以下方式检查版本:
javap -verbose MyClass | grep "major"