2017-01-16 57 views
0

我想註冊我的Spring引導應用程序到尤里卡服務器。該應用程序中獲得的開始,但在運行時我得到

"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] 

的build.gradle:

buildscript { 
repositories { 
    mavenCentral() 
} 
dependencies { 
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootGradleVersion}") 
}} 

dependencies { 
compile("org.springframework.boot:spring-boot-starter-data-jpa") 
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-config' 
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka' 

}

任何幫助,高度讚賞。

在此先感謝!

回答

1

你可能丟失了所有必要的WS依賴。由於你使用Spring啓動,這將是讓他們的最佳方式:

compile("org.springframework.boot:spring-boot-starter-web-services") 
// or 
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web-services' 

根據您的春天啓動的版本,它可以被稱爲spring-boot-starter-ws代替。

P.S.我不確定你爲什麼混合依賴樣式。只需選擇一個,並在任何地方使用。

1

嘗試增加這種依賴性:

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