Error scanning entry "module-info.class" when starting Jetty server

18,028

module-info.class is a Java9 (JPMS) feature.

Jetty 9.4.9 (or newer) supports the new JAR file changes from Java 9.

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 files in your WebApp (or Server classloader) then you are required to upgrade your Jetty version to 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.

Issues about Java 9 features:

Share:
18,028

Related videos on Youtube

Puliyur ranganath
Author by

Puliyur ranganath

Updated on June 04, 2022

Comments

  • Puliyur ranganath
    Puliyur ranganath almost 2 years

    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.

     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$1.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$1.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)
    
    • Nathan Arthur
      Nathan Arthur almost 7 years
      Welcome to StackOverflow! What have you tried so far? Show your work. :)
    • Puliyur ranganath
      Puliyur ranganath almost 7 years
      I have tried to use an earlier version of slf. It works if i use version 1.7.9.
    • David Pérez Cabrera
      David Pérez Cabrera almost 7 years
      What is the jetty version? and Java 7, 8?
    • Puliyur ranganath
      Puliyur ranganath almost 7 years
      jetty 9.2.4.v20141103 ; java 8
    • David Pérez Cabrera
      David Pérez Cabrera almost 7 years
      have you include a Bridge to Slf4j?
    • Puliyur ranganath
      Puliyur ranganath almost 7 years
      I'm not sure what that means. We just have the following dependancies in our build.gradle: compile 'org.slf4j:slf4j-api:1.+' compile 'org.slf4j:log4j-over-slf4j:1.+' compile 'org.slf4j:jcl-over-slf4j:1.+'
    • David Pérez Cabrera
      David Pérez Cabrera almost 7 years
      Can you post your build.gradle file? It can help
    • Joakim Erdfelt
      Joakim Erdfelt almost 7 years
      module-info.class is a JDK9 (JPMS) feature. Jetty does not support JDK9 (yet). - filed issue about this at github.com/eclipse/jetty.project/issues/1692
  • Pavel_K
    Pavel_K over 6 years
    Could you say when jetty will support JDK 9?
  • ArtOfWarfare
    ArtOfWarfare almost 5 years
    @Pavel_K - The answer was already updated to say this, but the answer is Jetty 9.4.x supports JDK 9. Further, it doesn't actually matter if you're using JDK 9 - I'm using JDK 8 but still having the issue, because some of the jars I'm pulling in are built against JDK 9.
  • lawrence
    lawrence over 4 years
    we are facing this issue. the verbose log is "Error scanning entry META-INF/versions/9/module-info.class" from jar file:///privare/var/folders/8n/x2m8yc21/xxx, the jetty version is 9.4.6. seen from @Joakim's answer, we need to upgrade to 9.4.9 +
  • Joakim Erdfelt
    Joakim Erdfelt over 4 years
    @lawrence be aware of security reports - eclipse.org/jetty/security-reports.html and what versions are available now - eclipse.org/jetty/documentation/current/what-jetty-version.h‌​tml
  • Abhi
    Abhi about 3 years
    I had this issue .Running the application from embedded jetty for 9.2.1 didn't gave any errors, but the standalone jetty was giving this error. I am using JDK 8 as well. Do you know how that happens
  • Joakim Erdfelt
    Joakim Erdfelt about 3 years
    @Abhi Simple explanation, embedded Jetty does not perform bytecode scanning unless you have added the specific configurations for it to. Standalone always does bytecode scanning.