Spring引导应用程序(eureka客户端)正在抛出ClassNotFoundException:javax.ws.rs.core.Response$StatusType

Spring引导应用程序(eureka客户端)正在抛出ClassNotFoundException:javax.ws.rs.core.Response$StatusType,java,spring,spring-boot,netflix-eureka,spring-io,Java,Spring,Spring Boot,Netflix Eureka,Spring Io,我正在尝试将我的Spring boot应用程序注册到eureka服务器。应用程序得到启动,但在运行时我得到 "java.lang.NoClassDefFoundError: javax/ws/rs/core/Response$StatusType at com.sun.jersey.api.client.ClientResponse.<init>(ClientResponse.java:381) ~[jersey-client-1.19.1.jar:1.19.1] a

我正在尝试将我的Spring boot应用程序注册到eureka服务器。应用程序得到启动,但在运行时我得到

"java.lang.NoClassDefFoundError: javax/ws/rs/core/Response$StatusType
    at com.sun.jersey.api.client.ClientResponse.<init>(ClientResponse.java:381) ~[jersey-client-1.19.1.jar:1.19.1]
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:176) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
    at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123) ~[jersey-client-1.19.1.jar:1.19.1]
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.4.12.jar:1.4.12]
    at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) ~[jersey-client-1.19.1.jar:1.19.1]
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) ~[jersey-client-1.19.1.jar:1.19.1]
}

非常感谢您的帮助


提前谢谢

尝试添加此依赖项:

// https://mvnrepository.com/artifact/javax.ws.rs/jsr311-api
compile group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'

尝试添加此依赖项:

// https://mvnrepository.com/artifact/javax.ws.rs/jsr311-api
compile group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'

您可能缺少所有必要的WS依赖项。当您使用Spring Boot时,这将是获得它们的最佳方式:

compile("org.springframework.boot:spring-boot-starter-web-services")
// or
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web-services'
根据您的Spring Boot版本,它可能被称为
Spring Boot starter ws


另外,我不知道你为什么混合依赖风格。只需选择一个并在任何地方使用它。

您可能缺少所有必要的WS-dependencies。当您使用Spring Boot时,这将是获得它们的最佳方式:

compile("org.springframework.boot:spring-boot-starter-web-services")
// or
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web-services'
根据您的Spring Boot版本,它可能被称为
Spring Boot starter ws

另外,我不知道你为什么混合依赖风格。随便挑一个,到处都可以用