eclipse 启动 Jetty 服务器时扫描条目“module-info.class”时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45311295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error scanning entry "module-info.class" when starting Jetty server
提问by Praveen Kumar
I'm seeing this recently when I start my java server. Has anyone else seen this? If so whats the fix? I can confirm the jar's and the module-info.class are present in the relevant paths.
我最近在启动 Java 服务器时看到了这一点。有没有其他人看过这个?如果是这样,修复方法是什么?我可以确认 jar 和 module-info.class 存在于相关路径中。
MultiException[java.lang.RuntimeException: Error scanning entry module-info.class from jar
file:jetty/9.2.4.v20141103/tempDirectory/webapp/WEB-INF/lib/slf4j-api-1.8.0-alpha2.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar
file:jetty/9.2.4.v20141103/tempDirectory/webapp/WEB-INF/lib/log4j-over-slf4j-1.8.0-alpha2.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar
file:jetty/9.2.4.v20141103/tempDirectory/webapp/WEB-INF/lib/jcl-over-slf4j-1.8.0-alpha2.jar] at
org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:535) at
org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:446) at
org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:473) at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1331) at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741) at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at
org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41) at
org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186) at
org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:498) at
org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:146) at
org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180) at
org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:64) at
org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:609) at
org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:528) at
org.eclipse.jetty.util.Scanner.scan(Scanner.java:391) at
org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at
org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at
org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:560) at
org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:235) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) at
org.eclipse.jetty.server.Server.start(Server.java:387) at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) at
org.eclipse.jetty.server.Server.doStart(Server.java:354) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at
org.eclipse.jetty.xml.XmlConfiguration.run(XmlConfiguration.java:1255) at
java.security.AccessController.doPrivileged(Native Method) at
org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at
java.lang.reflect.Method.invoke(Method.java:483) at
org.eclipse.jetty.start.Main.invokeMain(Main.java:323) at
org.eclipse.jetty.start.Main.start(Main.java:820) at
org.eclipse.jetty.start.Main.main(Main.java:112)
回答by Joakim Erdfelt
module-info.class
is a Java9 (JPMS) feature.
module-info.class
是 Java9 (JPMS) 功能。
Jetty 9.4.9 (or newer) supports the new JAR file changes from Java 9.
Jetty 9.4.9(或更新版本)支持对 Java 9 的新 JAR 文件更改。
It does not matter what Runtime JVM you are using (Oracle Java 8, or even something like OpenJDK 11.0.3), if you are using those JEP-238 Multi-Release Jar filesin your WebApp (or Server classloader) then you are required to upgrade your Jetty version to Jetty 9.4.x.
无论您使用的是什么运行时 JVM(Oracle Java 8,甚至是 OpenJDK 11.0.3 之类的),如果您在 WebApp(或服务器类加载器)中使用那些JEP-238 Multi-Release Jar 文件,那么您是必需的将您的 Jetty 版本升级到 Jetty 9.4.x。
This is because of the bytecode scanning requirement that Servlet 3.x introduces. Jetty is required to scan all JAR files for possible servlet annotations or references that match your webapp defined @HandlesTypes
. Once JEP-238 became a reality, this bytecode scanning layer had to be adapted/updated/fixed to support these new JAR file structures. Jetty 9.4.9 was the first version of Jetty to support these new JAR file structures during bytecode scanning.
这是因为 Servlet 3.x 引入了字节码扫描要求。Jetty 需要扫描所有 JAR 文件以查找与您的 web 应用程序定义匹配的可能的 servlet 注释或引用@HandlesTypes
。一旦 JEP-238 成为现实,就必须调整/更新/修复这个字节码扫描层以支持这些新的 JAR 文件结构。Jetty 9.4.9 是第一个在字节码扫描期间支持这些新 JAR 文件结构的 Jetty 版本。
Issues about Java 9 features:
关于 Java 9 特性的问题:
- https://github.com/eclipse/jetty.project/issues/1692- excluding
module-info.class
from bytecode scanning. - https://github.com/eclipse/jetty.project/issues/1797- supporting
META-INF/versions/*
Multi-Release JAR files (JEP 238) properly.
- https://github.com/eclipse/jetty.project/issues/1692-
module-info.class
从字节码扫描中排除。 - https://github.com/eclipse/jetty.project/issues/1797- 正确支持
META-INF/versions/*
多版本 JAR 文件(JEP 238)。