NoClassDefFoundError ProcessingException while migrating from jersey 1.x to jersey 2.x ( 2.8 )

血红的双手。 提交于 2019-12-01 18:18:20

Exception you are getting is happening because you downloaded "javax.ws.rs-api-2.0-m09.jar" this jar doesn't have ProcessingException download the latest one

Class not foundCaused by: java.lang.NoClassDefFoundError: javax/ws/rs/ProcessingException

Download this jar javax.ws.rs-api-2.0.jar

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0</version>
</dependency>

Secondly I think you are missing a part from your web.xml

Try adding these things to your web.xml as appropriate for you application. If you don't have this section this may also lead to SEVERE: A child container failed during start....

This is what you are missing. Please note that param-value is the list of packages that contain your rest services.

<servlet>
    <servlet-name>jersey-serlvet</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>jersey.config.server.provider.packages;org.codehaus.jackson.jaxrs</param-name>
        <param-value>com.your.package.for.rest</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

To get latest Jackson use this Link

<dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-json-provider</artifactId>
    <version>2.3.3</version>
</dependency>

If you are working in eclipse. Just remove the libraries from Deployment Assembly and add them again. Sometimes after adding new jar does not update the library of the web application

BuildPath->Deployment Assembly

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