简体   繁体   English

jersey-spring3(2.25.1)在Jetty-9.3.3中产生“上下文启动失败”错误

[英]jersey-spring3 (2.25.1) produces “Failed startup of context” error in jetty-9.3.3

I am using Jersey-2.25.1 with Spring framework 4.3.5 in Jetty-9.3.3 environment. 我在Jetty-9.3.3环境中使用带有Spring框架4.3.5的Jersey-2.25.1。 My OS is Centos 7 and JDK 8. During deployment time, I am receiving the following error: 我的操作系统是Centos 7和JDK8。在部署期间,我收到以下错误:

Note: The following error occurred, only when jersey-spring3 dependency is added in the pom.xml. 注意:仅当pom.xml中添加了jersey-spring3依赖项时,才会发生以下错误。

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? Jetty的/lib/annotations/asm-5.0.1.jar和asm-commons-5.0.1.jar或jersey-spring3.jar是否有问题?

I looked into module-info.class file 我调查了module-info.class文件

$ 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 . 因此,它是使用Java 9进行编译的,并且是Java 9中新模块系统的一部分。

Anyway, there is no use in scanning this file (especially with java 8). 无论如何,扫描此文件没有用(特别是在Java 8中)。

I fixed the issue by excluding asm-all-repackaged.jar from jetty annotation scanning: 我通过从码头注释扫描中排除asm-all-repackaged.jar来解决此问题:

<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 这是关于webInfIncludeJarPattern的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM