java.lang.ClassNotFoundException:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

时间:2019-04-11 18:05:51

标签: java jackson jax-rs glassfish-4.1

注意:我已经尝试过herehere

中提到的解决方案

我正在使用JAX-RS的应用程序上工作。当我尝试发布请求时,出现以下异常:

java.lang.NoClassDefFoundError:com / fasterxml / jackson / module / jaxb / JaxbAnnotationIntrospector

java.lang.ClassNotFoundException:com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider未找到com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector [92]

我正在使用的服务器是Glassfish 4.1.2

我尝试在pom.xml中添加必需的Jackson(com.fasterxml.jackson.jaxrs)依赖项,但仍然遇到相同的错误。

pom.xml

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.1</version>
</dependency>
<dependency>
         <groupId>org.glassfish.jersey.containers</groupId>
         <artifactId>jersey-container-servlet</artifactId>
         <version>2.26</version>
    </dependency>
    <dependency>
         <groupId>org.glassfish.jersey.core</groupId>
         <artifactId>jersey-server</artifactId>
         <version>2.26</version>
    </dependency>
    <dependency>
         <groupId>org.glassfish.jersey.inject</groupId>
         <artifactId>jersey-hk2</artifactId>
         <version>2.26</version>
    </dependency>
    <dependency>
         <groupId>com.fasterxml.jackson.jaxrs</groupId>
         <artifactId>jackson-jaxrs-json-provider</artifactId>
         <version>2.9.8</version>
    </dependency>
    <dependency>
         <groupId>com.fasterxml.jackson.module</groupId>
         <artifactId>jackson-module-jaxb-annotations</artifactId>
         <version>2.9.8</version>
    </dependency>
<dependency>
         <groupId>com.fasterxml.jackson.jaxrs</groupId>
         <artifactId>jackson-jaxrs-base</artifactId>
         <version>2.9.8</version>
    </dependency>

0 个答案:

没有答案