Reputation: 367
I am using Jersey-2.25.1 with Spring framework 4.3.5 in Jetty-9.3.3 environment. My OS is Centos 7 and JDK 8. During deployment time, I am receiving the following error:
Note: The following error occurred, only when jersey-spring3 dependency is added in the pom.xml.
Failed startup of context o.e.j.w.WebAppContext@5d37aa0f{/test-service,file:///.../test-service/,STARTING}
java.lang.RuntimeException: Error scanning entry module-info.class from jar file:///.../test-service/WEB-INF/lib/asm-all-repackaged-2.5.0-b32.jar
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:925)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:842)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:545)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
Caused by:
java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:988)
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:970)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:921)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:842)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:545)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
Is it problem with Jetty's /lib/annotations/asm-5.0.1.jar and asm-commons-5.0.1.jar or jersey-spring3.jar?
Upvotes: 2
Views: 2346
Reputation: 2711
I looked into module-info.class file
$ javap -v ./module-info.class
...
class org.glassfish.hk2.external.org.objectweb.asm.all.debug.module-info
minor version: 0
major version: 53
So, it is compiled with java 9, and it is a part new module system in java 9.
Anyway, there is no use in scanning this file (especially with java 8).
I fixed the issue by excluding asm-all-repackaged.jar
from jetty annotation scanning:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.0.v20161208</version>
<configuration>
<webApp>
...
<webInfIncludeJarPattern>.*/^(asm-all-repackaged)[^/]*\.jar$</webInfIncludeJarPattern>
</webApp>
</configuration>
</plugin>
Here is documentation about webInfIncludeJarPattern
Upvotes: 5