Error scanning entry module-info.class from jar ......

java.lang.RuntimeException: Error scanning entry module-info.class from jar file:///tmp/jetty-0.0.0.0-9092-appservice-web-war.war-_-any-7965089778299466044.dir/webapp/WEB-INF/lib/lombok-1.16.22.jar

at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:937)

    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)

    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)

    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)

    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)

    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)

    at java.lang.Thread.run(Thread.java:745)

Caused by:

java.lang.IllegalArgumentException

    at org.objectweb.asm.ClassReader.(Unknown Source)

    at org.objectweb.asm.ClassReader.(Unknown Source)

    at org.objectweb.asm.ClassReader.(Unknown Source)

    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:1003)

    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:984)

    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:933)

    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)

    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)

    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)

    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)

    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)

    at java.lang.Thread.run(Thread.java:745)

module-info.class 是 JDK9中的新featrure;

If a class has a JDK9 / JPMS specific feature known as module-info.class, then this class should never be scanned for annotations by Jetty's bytecode scanner.

To reproduce this bug, include the following classes in the WEB-INF/lib of a war file.

slf4j-api-1.8.0-alpha2.jar
log4j-over-slf4j-1.8.0-alpha2.jar
jcl-over-slf4j-1.8.0-alpha2.jar

原因可能是:报错中lombok的版本使用了JEP-238 Multi-Release JAR Files.(尚未查证);

解决方式:

1)、找到正确的lombok版本,未使用JEP-238 Multi-Release JAR Files.

2)、升级jetty版本到9.4.X,新的版本中忽略了module-info.class的扫描

 

什么是(JEP-238) Multi-Release JAR Files?

java9提供的multi-release jar的功能,可以在一个jar包打入多个jdk版本,同时在java9及以上的版本支持multi-release。

它的好处就是比如从java8到java9的迁移,如果java8依赖的jar本身就是multi-release的,那么升级到java9就比较方便,不用再改maven依赖。

不好的地方就是有过度设计的味道,一个jar包含多个版本的class,显得有些冗余。

你可能感兴趣的:(Java基础)