使用Spring Cloud Brixton SR7来表达客户端

时间:2016-12-01 13:06:16

标签: spring-cloud spring-cloud-netflix netflix-feign spring-cloud-feign feign

我正在尝试将Feign Client与新的Spring Cloud版本(Brixton.SR7)一起使用,但我遇到了问题。

每当我尝试在Eureka Server中对注册服务进行REST调用时,我都有例外:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: rx/functions/Func1] with root cause

java.lang.ClassNotFoundException: rx.functions.Func1

我的主要课程是使用@EnableFeignClients启用FeignClients。

有我的项目依赖项:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/>
</parent>

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Brixton.SR7</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

使用旧的Spring Cloud版本(Brixton.SR6)它运行正常。

我应该添加一些依赖关系RxJava吗?

编辑:

SR6依赖树:

[INFO] com.pillo:client:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.cloud:spring-cloud-starter-eureka:jar:1.1.6.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.4.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter:jar:1.4.2.RELEASE:compile
[INFO] |  |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.2.RELEASE:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] |  |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] |  |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] |  |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.2.RELEASE:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.6:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.6:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.6:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.4:compile
[INFO] |  |  \- org.springframework:spring-webmvc:jar:4.3.4.RELEASE:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:4.3.4.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:1.1.3.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:1.1.3.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.1.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.47:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.47:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-core:jar:1.1.6.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.2.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.2.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:1.1.6.RELEASE:compile
[INFO] |  +- com.netflix.eureka:eureka-client:jar:1.4.10:compile
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.3.7:runtime
[INFO] |  |  |  \- stax:stax-api:jar:1.0.1:runtime
[INFO] |  |  +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:runtime
[INFO] |  |  +- com.netflix.archaius:archaius-core:jar:0.7.4:compile
[INFO] |  |  +- javax.ws.rs:jsr311-api:jar:1.1.1:runtime
[INFO] |  |  +- com.netflix.servo:servo-core:jar:0.10.1:runtime
[INFO] |  |  |  \- com.netflix.servo:servo-internal:jar:0.10.1:runtime
[INFO] |  |  +- com.sun.jersey:jersey-core:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey:jersey-client:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:runtime
[INFO] |  |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.5:runtime
[INFO] |  |  |  \- commons-codec:commons-codec:jar:1.10:runtime
[INFO] |  |  +- com.google.inject:guice:jar:4.0:runtime
[INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:runtime
[INFO] |  |  +- com.netflix.governator:governator-api:jar:1.12.10:runtime
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.4:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.4:compile
[INFO] |  +- com.netflix.eureka:eureka-core:jar:1.4.10:compile
[INFO] |  |  +- com.amazonaws:aws-java-sdk-core:jar:1.11.18:runtime
[INFO] |  |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.4:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-ec2:jar:1.11.18:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-autoscaling:jar:1.11.18:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-sts:jar:1.11.18:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-route53:jar:1.11.18:runtime
[INFO] |  |  +- com.netflix.governator:governator:jar:1.12.10:runtime
[INFO] |  |  |  \- com.netflix.governator:governator-core:jar:1.12.10:runtime
[INFO] |  |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime
[INFO] |  |     +- javax.xml.stream:stax-api:jar:1.0-2:runtime
[INFO] |  |     \- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-archaius:jar:1.1.6.RELEASE:compile
[INFO] |  |  +- commons-configuration:commons-configuration:jar:1.8:compile
[INFO] |  |  \- com.google.guava:guava:jar:18.0:compile
[INFO] |  +- com.netflix.ribbon:ribbon-eureka:jar:2.2.0:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.4.2:compile
[INFO] |     +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |     \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-feign:jar:1.1.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-context:jar:4.3.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-core:jar:4.3.4.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-commons:jar:1.1.3.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-crypto:jar:4.1.3.RELEASE:compile
[INFO] |  +- com.netflix.feign:feign-core:jar:8.16.2:compile
[INFO] |  |  \- org.jvnet:animal-sniffer-annotation:jar:1.0:runtime
[INFO] |  +- com.netflix.feign:feign-slf4j:jar:8.16.2:compile
[INFO] |  \- com.netflix.feign:feign-hystrix:jar:8.16.2:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.1.6.RELEASE:compile
[INFO] |  +- com.netflix.ribbon:ribbon:jar:2.2.0:compile
[INFO] |  |  +- com.netflix.ribbon:ribbon-transport:jar:2.2.0:runtime
[INFO] |  |  |  +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime
[INFO] |  |  |  \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime
[INFO] |  |  +- javax.inject:javax.inject:jar:1:runtime
[INFO] |  |  \- io.reactivex:rxnetty:jar:0.4.9:runtime
[INFO] |  |     +- io.netty:netty-codec-http:jar:4.0.27.Final:runtime
[INFO] |  |     |  +- io.netty:netty-codec:jar:4.0.27.Final:runtime
[INFO] |  |     |  \- io.netty:netty-handler:jar:4.0.27.Final:runtime
[INFO] |  |     \- io.netty:netty-transport-native-epoll:jar:4.0.27.Final:runtime
[INFO] |  |        +- io.netty:netty-common:jar:4.0.27.Final:runtime
[INFO] |  |        +- io.netty:netty-buffer:jar:4.0.27.Final:runtime
[INFO] |  |        \- io.netty:netty-transport:jar:4.0.27.Final:runtime
[INFO] |  +- com.netflix.ribbon:ribbon-core:jar:2.2.0:compile
[INFO] |  |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- com.netflix.ribbon:ribbon-httpclient:jar:2.2.0:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  |  \- com.netflix.netflix-commons:netflix-commons-util:jar:0.1.1:runtime
[INFO] |  +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.2.0:compile
[INFO] |  |  \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime
[INFO] |  \- io.reactivex:rxjava:jar:1.1.5:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-hystrix:jar:1.1.6.RELEASE:compile
[INFO] |  +- com.netflix.hystrix:hystrix-core:jar:1.5.3:compile
[INFO] |  |  \- org.hdrhistogram:HdrHistogram:jar:2.1.7:compile
[INFO] |  +- com.netflix.hystrix:hystrix-metrics-event-stream:jar:1.5.3:compile
[INFO] |  \- com.netflix.hystrix:hystrix-javanica:jar:1.5.3:compile
[INFO] |     +- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |     +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] |     \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] \- org.projectlombok:lombok:jar:1.16.10:provided

SR7依赖树:

[INFO] com.pillo:client:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.cloud:spring-cloud-starter-eureka:jar:1.1.7.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.4.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter:jar:1.4.2.RELEASE:compile
[INFO] |  |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.2.RELEASE:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] |  |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] |  |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] |  |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.2.RELEASE:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.6:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.6:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.6:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.4:compile
[INFO] |  |  \- org.springframework:spring-webmvc:jar:4.3.4.RELEASE:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:4.3.4.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:1.1.3.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:1.1.3.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.3.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-core:jar:1.1.7.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.2.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.2.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:1.1.7.RELEASE:compile
[INFO] |  +- com.netflix.eureka:eureka-client:jar:1.4.12:compile
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.3.7:runtime
[INFO] |  |  |  \- stax:stax-api:jar:1.0.1:runtime
[INFO] |  |  +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:runtime
[INFO] |  |  +- com.netflix.archaius:archaius-core:jar:0.7.4:compile
[INFO] |  |  +- javax.ws.rs:jsr311-api:jar:1.1.1:runtime
[INFO] |  |  +- com.netflix.servo:servo-core:jar:0.10.1:runtime
[INFO] |  |  |  \- com.netflix.servo:servo-internal:jar:0.10.1:runtime
[INFO] |  |  +- com.sun.jersey:jersey-core:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey:jersey-client:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:runtime
[INFO] |  |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.5:runtime
[INFO] |  |  |  \- commons-codec:commons-codec:jar:1.10:runtime
[INFO] |  |  +- com.google.inject:guice:jar:4.0:runtime
[INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:runtime
[INFO] |  |  +- com.netflix.governator:governator-api:jar:1.12.10:runtime
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.4:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.4:compile
[INFO] |  +- com.netflix.eureka:eureka-core:jar:1.4.12:compile
[INFO] |  |  +- com.amazonaws:aws-java-sdk-core:jar:1.11.18:runtime
[INFO] |  |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.4:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-ec2:jar:1.11.18:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-autoscaling:jar:1.11.18:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-sts:jar:1.11.18:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-route53:jar:1.11.18:runtime
[INFO] |  |  +- com.netflix.governator:governator:jar:1.12.10:runtime
[INFO] |  |  |  \- com.netflix.governator:governator-core:jar:1.12.10:runtime
[INFO] |  |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime
[INFO] |  |     +- javax.xml.stream:stax-api:jar:1.0-2:runtime
[INFO] |  |     \- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-archaius:jar:1.1.7.RELEASE:compile
[INFO] |  |  +- commons-configuration:commons-configuration:jar:1.8:compile
[INFO] |  |  \- com.google.guava:guava:jar:18.0:compile
[INFO] |  +- com.netflix.ribbon:ribbon-eureka:jar:2.2.0:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.4.9:compile
[INFO] |     +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |     \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-feign:jar:1.1.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-context:jar:4.3.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-core:jar:4.3.4.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-commons:jar:1.1.3.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-crypto:jar:4.1.3.RELEASE:compile
[INFO] |  +- com.netflix.feign:feign-core:jar:8.16.2:compile
[INFO] |  |  \- org.jvnet:animal-sniffer-annotation:jar:1.0:runtime
[INFO] |  +- com.netflix.feign:feign-slf4j:jar:8.16.2:compile
[INFO] |  \- com.netflix.feign:feign-hystrix:jar:8.16.2:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.1.7.RELEASE:compile
[INFO] |  +- com.netflix.ribbon:ribbon:jar:2.2.0:compile
[INFO] |  |  +- com.netflix.ribbon:ribbon-transport:jar:2.2.0:runtime
[INFO] |  |  |  +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime
[INFO] |  |  |  \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime
[INFO] |  |  +- javax.inject:javax.inject:jar:1:runtime
[INFO] |  |  \- io.reactivex:rxnetty:jar:0.4.9:runtime
[INFO] |  |     +- io.netty:netty-codec-http:jar:4.0.27.Final:runtime
[INFO] |  |     |  +- io.netty:netty-codec:jar:4.0.27.Final:runtime
[INFO] |  |     |  \- io.netty:netty-handler:jar:4.0.27.Final:runtime
[INFO] |  |     \- io.netty:netty-transport-native-epoll:jar:4.0.27.Final:runtime
[INFO] |  |        +- io.netty:netty-common:jar:4.0.27.Final:runtime
[INFO] |  |        +- io.netty:netty-buffer:jar:4.0.27.Final:runtime
[INFO] |  |        \- io.netty:netty-transport:jar:4.0.27.Final:runtime
[INFO] |  +- com.netflix.ribbon:ribbon-core:jar:2.2.0:compile
[INFO] |  |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- com.netflix.ribbon:ribbon-httpclient:jar:2.2.0:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  |  \- com.netflix.netflix-commons:netflix-commons-util:jar:0.1.1:runtime
[INFO] |  +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.2.0:compile
[INFO] |  |  \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime
[INFO] |  \- io.reactivex:rxjava:jar:1.1.10:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-hystrix:jar:1.1.7.RELEASE:compile
[INFO] |  +- com.netflix.hystrix:hystrix-core:jar:1.5.3:compile
[INFO] |  |  \- org.hdrhistogram:HdrHistogram:jar:2.1.7:compile
[INFO] |  +- com.netflix.hystrix:hystrix-metrics-event-stream:jar:1.5.3:compile
[INFO] |  \- com.netflix.hystrix:hystrix-javanica:jar:1.5.3:compile
[INFO] |     +- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |     +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] |     \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] \- org.projectlombok:lombok:jar:1.16.10:provided

谢谢!

0 个答案:

没有答案