【问题标题】:java.lang.RuntimeException: Error scanning entry module-info.class from jarjava.lang.RuntimeException:从 jar 扫描条目 module-info.class 时出错
【发布时间】:2019-03-13 22:32:04
【问题描述】:

我尝试用 gretty 运行项目。它抛出异常:

10:47:39 WARN  Failed startup of context o.a.g.JettyWebAppContext@52045dbe{/,file:/C:/IdeaProjects/example-tab/build/inplaceWebapp/,STARTING}
java.lang.RuntimeException: Error scanning entry module-info.class from jar file:/C:/Users/user1/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.10.0/fec5797a55b786184a537abd39c3fa1449d752d6/log4j-api-2.10.0.jar
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:164) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:549) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) ~[jetty-util-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) ~[jetty-util-9.2.24.v20180105.jar:9.2.24.v20180105]
    at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_171]
Caused by: java.lang.UnsupportedOperationException: null
    at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:129) ~[asm-6.1.1.jar:na]
    at org.objectweb.asm.ClassReader.readModule(ClassReader.java:667) ~[asm-6.1.1.jar:na]
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:503) ~[asm-6.1.1.jar:na]
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:355) ~[asm-6.1.1.jar:na]
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
    ... 6 common frames omitted

分级:

plugins {
    id 'java'
    id 'war'
    id "org.gretty" version "2.2.0"
}
group 'ru.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

ext {
    SPRING_VERSION = '5.1.0.RELEASE'
    JUNIT_VERSION = '5.3.1'
    JACKSON_VERSION = '2.9.7'
}

repositories {

    mavenCentral()
    jcenter()

    maven {
        url 'https://oss.sonatype.org/content/repositories/releases/'
    }
}

gretty {
    springBootVersion = '2.0.5.RELEASE'
    contextPath = "/"
}

dependencies {
    annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
    compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
    compileOnly group: 'com.google.appengine', name: 'appengine-endpoints-deps', version: '1.9.65'
    compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
    compile group: 'org.springframework', name: 'spring-webmvc', version: SPRING_VERSION
    compile group: 'org.springframework', name: 'spring-web', version: SPRING_VERSION
    compile group: 'org.springframework', name: 'spring-jdbc', version: SPRING_VERSION
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.0.5.RELEASE'
    compile group: 'com.mchange', name: 'c3p0', version: '0.9.5.2'
    compile group: 'com.zaxxer', name: 'HikariCP', version: '3.2.0'
    compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.3.0'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: JACKSON_VERSION
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: JACKSON_VERSION
    compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.7'
    testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: JUNIT_VERSION
    testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: JUNIT_VERSION
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.3.1'
    testCompile group: 'org.mockito', name: 'mockito-core', version: '2.22.0'
    testCompile group: 'org.springframework', name: 'spring-test', version: SPRING_VERSION
    testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
    testCompile group: 'com.jayway.jsonpath', name: 'json-path-assert', version: '2.4.0'
}

test {
    useJUnitPlatform()
}

扫描互联网没有帮助。请建议如何正确运行它。我从 jcenter() 下载依赖项时遇到问题,可能是,问题就在这里。

验证者写道,我的问题主要是代码,但我不知道要在我的解释中添加什么,我很抱歉,我会引用史蒂夫乔布斯的话:

“你无法将点点滴滴向前看;你只能向后看。所以你必须相信这些点点滴滴会在你的未来以某种方式连接起来。”

【问题讨论】:

标签: java jetty gretty


【解决方案1】:

您在项目中引入了 JEP-238 Jar 文件:log4j-api-2.10.0.jar

在任何 Java 运行时(无论是 Java 7、Java 8、Java 9、Java 10、Java 11 还是新的 Java 12-ea 版本都无所谓)上的 JEP-238 Jar 文件支持首次引入码头 9.4.9.

你有两个选择:

  1. 不要在您的项目中使用 JEP-238 Jar 文件。
  2. 升级到 Jetty 9.4.9(或更高版本)以支持 JEP-238 Jar 文件。

查看过去的答案:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-03
    • 2019-05-22
    • 2021-08-18
    • 1970-01-01
    相关资源
    最近更新 更多