Failed startup of context c.g.g.d.s.j.WebAppContextWithReload

让人想犯罪 __ 提交于 2020-01-05 07:10:09

问题


I need help with an issue I have no idea how to resolve. Your help will be greatly appreciated.

I just added log4j2 jars (log4j-api-2.10.0.jar, log4j-core-2.10.0.jar) to my Web app and it started running into this problem in my dev. Later I added log4j-web-2.10.0.jar and tried, it still fails with the same message.

Here's my environment:

IDE: Eclipse Oxygen2
JDK: 1.8.0_162
Jetty (embedded in Eclipse): jetty-9.2.z-SNAPSHOT
OS: Win 10 (64bit)
Framework: GWT 2.8.2

Stack trace (partial):

[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@3a24f397{/,file:<project_path>/war/,STARTING}{<project_path>\war}
MultiException[java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class from jar file:<project_path>/war/WEB-INF/lib/log4j-api-2.10.0.jar, java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class from jar file:<project_path>/war/WEB-INF/lib/log4j-api-2.10.0.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar file:<project_path>/war/WEB-INF/lib/log4j-api-2.10.0.jar]
    at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:536)
    at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:447)
    at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
    .
    .
    .
Caused by: MultiException[java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class from jar file:<project_path>/WEB-INF/lib/log4j-api-2.10.0.jar, java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class from jar file:<project_path>/WEB-INF/lib/log4j-api-2.10.0.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar file:<project_path>/WEB-INF/lib/log4j-api-2.10.0.jar]
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:899)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)

回答1:


Copied from https://github.com/eclipse/jetty.project/issues/2192, (with additional edits)

This is related to your use of a JEP-238 Multi-Release JAR.

Notice the path ..

META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class

The META-INF/versions/<java.specification.version>/* path prefix tells you that the classes below that path are for that specific version of Java, replacing potentially the same named classes in the top level JAR.

Issue #1797 is where this was first reported and fixed.

It was fixed for ...

  • jetty-9.3.22.v20171030 - 30 October 2017
  • jetty-9.4.8.v20171121 - 21 November 2017

Since Jetty 9.2.x is end of life, there will be no backport to support JEP-238 on Jetty 9.2.x.

Your choices are to upgrade to one of the supported versions listed above, or downgrade your version of log4j to one that does not use JEP-238 Multi-Release JAR Files.

Also of note, the log4j JEP-238 Multi-Release JAR file you are using is also a Java 9 JPMS module.

The presence module-info.class indicates that.

Support in Jetty to ignore module-info.class during bytecode scanning was fixed in Issue #1692



来源:https://stackoverflow.com/questions/48716306/failed-startup-of-context-c-g-g-d-s-j-webappcontextwithreload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!