You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Java17升级遇依赖冲突,求兼容Helidon/Jersey/Spock的GitHub示例

问题:Java 17升级中的依赖冲突与示例项目推荐

问题背景

将代码库从Java 8/11升级至Java 17时,遭遇Helidon、Jersey、Jackson、Spock、Groovy等技术栈的依赖冲突,触发如下报错:

org.spockframework.util.InternalSpockError: Failed to instantiate spec 'CQRSExceptionMapperSpec'
        at app//org.spockframework.runtime.PlatformSpecRunner.createSpecInstance(PlatformSpecRunner.java:80)
        at app//org.spockframework.runtime.PlatformSpecRunner.runSharedSpec(PlatformSpecRunner.java:45)
. . .
Caused by: java.util.ServiceConfigurationError: Error instantiating :io.helidon.microprofile.server.JaxRsCdiExtension
. . .
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    io/helidon/microprofile/server/JaxRsCdiExtension.toJerseySupport(Ljava/util/function/Supplier;Lio/helidon/microprofile/server/JaxRsApplication;Lorg/glassfish/jersey/internal/inject/InjectionManager;)Lio/helidon/webserver/jersey/JerseySupport; @4: invokestatic
  Reason:
    Type 'org/glassfish/jersey/server/ResourceConfig' (current frame, stack[0]) is not assignable to 'javax/ws/rs/core/Application'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'io/helidon/microprofile/server/JaxRsCdiExtension', 'java/util/function/Supplier', 'io/helidon/microprofile/server/JaxRsApplication', 'org/glassfish/jersey/internal/inject/InjectionManager' }
    stack: { 'org/glassfish/jersey/server/ResourceConfig' }
  Bytecode:
    0000000: 2cb6 004d b800 4e3a 0419 04b8 0035 c000
    0000010: 4f12 50b9 0051 0200 b600 5257 1904 2cb6
    0000020: 0053 2bb6 0054 c000 55b6 0056 5719 04bb
    0000030: 0057 592a b700 58b6 0059 5719 042d b600
    0000040: 5a57 1904 b600 5bb0                    

    at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
    at java.base/java.lang.Class.getConstructor0(Class.java:3578)
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2754)
    at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:311)
    ... 81 more

已尝试常规排查步骤但未解决问题,当前项目Gradle依赖版本配置如下:

ext {
    immutablesVersion = "2.8.8"
    // helidonVersion = "2.6.0"
    helidonVersion = "2.6.2"
    jandexVersion = "0.8.0"
    groovyVersion = "4.0.13"
    spockVersion = "2.3-groovy-4.0"
    jacksonVersion = "2.14.2"
    jerseyJacksonVersion = "3.1.3"
    slf4jVersion = "1.7.30"
    log4j2Version="2.17.1"
    jerseyClientVersion = "2.31"
    apacheCommonsLang3Version = "3.8.1"
    jacksonAnnotationsVersion = "2.14.2"
    jacksonDataformatVersion = "2.14.2"
    jacksonDatabindVersion = "2.14.2"
    gcsVersion = "2.7.2"
    commonsCodecVersion = "1.15"
    nettyVersion = "4.1.86.Final"
    apacheCommonsVersion = "3.8.1"
    commonsCompressVersion = "2.1"
    bouncyCastleBcprovVersion = "1.67"
    jsltVersion = "0.1.11"
    googleLibrariesVersion = "26.1.3"
    prometheusJmxAgentVersion = "0.17.2"
    testngVersion = "7.7.1"
    jsonVersion = "20230227"
    jose4jVersion = "0.9.3"
    lz4JavaVersion = "1.8.0"
    kafkaVersion = "3.4.0"
}

请求

恳请推荐使用上述核心技术(Helidon、Jersey、Jackson、Spock、Groovy)且兼容Java 17的GitHub示例项目,以便参考协调后的依赖版本。

内容的提问来源于stack exchange,提问作者Eric Kolotyluk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 22:54:53