JDK 版本问题(ASM5 无法创建注解扫描器异常)

JDK version issue (ASM5 unable to create annotation scanner exception)

我最近在做 2 个不同的项目,一个基于 Tomee 和 JDK8,另一个基于 Quarkus 和 JDK11。在我切换我的环境之后。变量指向 JDK8 我突然无法构建基于 JDK8 的项目。

我得到以下异常:

 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/app]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module app: null
    at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2305)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1188)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
    at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module app: null
    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:2303)
    ... 16 more
Caused by: java.lang.IllegalArgumentException
    at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
    at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
    at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
    at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1169)
    at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:147)
    at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:160)
    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)
    ... 18 more

我也试过重新安装 JDK。

java -version 的输出是:

java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

我从控制台使用 Maven 而不是 IDE 构建项目,并使用 Maven Tomee 插件 运行 它:

mvn tomee:run

mvn -version 的输出是:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Dev\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin\..
Java version: 1.8.0_291, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_291\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

我还检查了 IntelliJ 设置,尽管我不是通过 IDE 运行 应用程序,而是在单独的 shell.

通过删除所有 JDK-s、删除 maven、删除本地 .m2 目录、删除签出的项目、删除所有 env 来解决。与 JDK 或 Maven.

相关的变量
  • 已安装 JDK 1.8
  • 安装了最新版本的maven
  • 再次从 repo 克隆项目
  • 编译并运行项目成功