加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 要为jersey.repackaged.com.google.common.collect.Maps

发布时间:2020-12-14 23:31:50 所属栏目:Java 来源:网络整理
导读:我正在尝试运行一个扩展JerseyTest的测试但是在运行时我得到了一个: java.lang.NoClassDefFoundError: jersey/repackaged/com/google/common/collect/Maps 知道我缺少什么依赖吗?我在我的pom.xml中包含了以下球衣工件,而jersey.version是2.5.1: dependenc
我正在尝试运行一个扩展JerseyTest的测试但是在运行时我得到了一个:
java.lang.NoClassDefFoundError: jersey/repackaged/com/google/common/collect/Maps

知道我缺少什么依赖吗?我在我的pom.xml中包含了以下球衣工件,而jersey.version是2.5.1:

<dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
        <version>${jersey.version}</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>${jersey.version}</version>
    </dependency>        

    <dependency>
        <groupId>com.sun.jersey.jersey-test-framework</groupId>
        <artifactId>jersey-test-framework-core</artifactId>
        <version>1.18</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.test-framework.providers</groupId>
        <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
        <version>2.6</version>
        <scope>test</scope>
    </dependency>

解决方法

你需要:
<dependency>
  <groupId>org.glassfish.jersey.bundles.repackaged</groupId>
  <artifactId>jersey-guava</artifactId>
  <version>2.6</version>
</dependency>

从http://blog.dejavu.sk/2014/02/21/jersey-2-6-has-been-released-new-and-noteworthy/起

Jersey,from versions 2.6 for JAX-RS 2.0 and 1.18.1 for JAX-RS 1.1,no longer transitively brings Guava and ASM libraries to your application. This means that even when we still use them internally you can use different versions of these libraries. Classes from both of these libraries has been repackaged,jersey.repackaged.com.google.common and jersey.repackaged.objectweb.asm respectively,and shrinked to lower the footprint. ASM 5 is now part of jersey-server core module and for Guava we’ve created a separate bundle module 07001 as this dependency is widely used in multiple Jersey modules.

你正在使用Jersey 2.6 jersey-test-framework-provider-grizzly2.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读