解决方案原文地址:http://stackoverflow.com/questions/41995029/jersey-spring3-2-25-1-produces-failed-startup-o
解决方案原文地址:http://stackoverflow.com/questions/41995029/jersey-spring3-2-25-1-produces-failed-startup-of-context-error-in-jetty-9-3
java.lang.RuntimeException: Error scanning entry module-info.class from jar
错误信息
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)
查看module-info具体信息:
$ javap -v ./module-info.class ...class org.glassfish.hk2.external.org.objectweb.asm.all.debug.module-infominor version: 0major version: 53
貌似module-info使用java9编译的(51是jdk1.7,52是jdk1.8,那53应该就是jdk1.9?,java9应该是openjdk的,并不是sun的jdk),但是低于java9运行报错
所以在plugin插件添加webInfIncludeJarPattern即可解决
<plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.4.2.v20170220</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <webApp> <contextPath>/</contextPath> <webInfIncludeJarPattern>.*/^(asm-all-repackaged)[^/]*/.jar$</webInfIncludeJarPattern> </webApp> <httpConnector> <port>${web.port}</port> </httpConnector> <!--关闭jetty自动部署与spring-loaded冲突 --> <reload>manual</reload> </configuration></plugin>