Closed yjwfn closed 5 years ago
This is almost always caused by a mismatched version. Can you show your pom?
This is almost always caused by a mismatched version. Can you show your pom?
Yes , I seen org.springframework.boot:spring-boot-starter-webflux:2.0.3.RELEASE
dependency onorg.springframework:spring-webflux:5.1.6.RELEASE
, but org.springframework:spring-webflux:5.1.6.RELEASE
incompatible with org.springframework.cloud:spring-cloud-gateway-core:2.0.3.RELEASE
。
This is almost always caused by a mismatched version. Can you show your pom?
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
</parent>
<groupId>cn.rctech.egg</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<java.version>1.8</java.version>
<jackson.version>2.9.7</jackson.version>
<dubbo.version>2.7.1</dubbo.version>
<spring-cloud.version>Finchley.SR3</spring-cloud.version>
<spring.version>5.1.6.RELEASE</spring.version>
<nacos.boot.version>0.2.1</nacos.boot.version>
<nacos.client.version>1.0.0</nacos.client.version>
<mysql.version>8.0.13</mysql.version>
</properties>
<dependencyManagement>
<!-- 声明一些常用的依赖项 -->
<dependencies>
<dependency>
<groupId>cn.rctech.egg</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>com.yunpian.sdk</groupId>
<artifactId>yunpian-java-sdk</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<!-- Note: core-annotations version x.y.0 is generally compatible with
(identical to) version x.y.1, x.y.2, etc. -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
<version>${nacos.boot.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-discovery-spring-boot-starter</artifactId>
<version>${nacos.boot.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${nacos.client.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-spring-context</artifactId>
<version>0.2.3-RC1</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-autoconfigure</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${dubbo.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-discovery-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
</dependencies>
The org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient
of org.springframework:spring-webflux:5.1.6.RELEASE
is :
public class ReactorNettyWebSocketClient implements WebSocketClient {
private static final Log logger = LogFactory.getLog(ReactorNettyWebSocketClient.class);
private final HttpClient httpClient;
/**
* Default constructor.
*/
public ReactorNettyWebSocketClient() {
this(HttpClient.create());
}
/**
* Constructor that accepts an existing {@link HttpClient} builder.
* @since 5.1
*/
public ReactorNettyWebSocketClient(HttpClient httpClient) {
Assert.notNull(httpClient, "HttpClient is required");
this.httpClient = httpClient;
}
.....
}
It's second constructor above need a HttpClient
object to instance, that mismatched with org/springframework/cloud/gateway/config/GatewayAutoConfiguration$NettyConfiguration.class
.
@Bean
public ReactorNettyWebSocketClient reactorNettyWebSocketClient(@Qualifier("nettyClientOptions") Consumer<? super HttpClientOptions.Builder> options) {
return new ReactorNettyWebSocketClient(options);
}
Hi @yjwfn Could you please try it out with Spring Boot Starter 2.0.9.RELEASE and let us know if the problem appears also with that setup?
Hi @yjwfn Could you please try it out with Spring Boot Starter 2.0.9.RELEASE and let us know if the problem appears also with that setup?
I upgrade to Spring Boot 2.1.5.RELEASE
and Spring Cloud Greenwich.RELEASE
already , it's working fine.
This problem I don't have any idea to resolve it, I think it is compatibility problem.
yes, but in your issue, you were using the most recent Finchley version with a Spring Boot 2.0.x version that was 6 minors behind the current one. Everything should work on Finchley + Spring Boot 2.0.x, so that's why I've suggested you try out with a more recent 2.0.x Boot (2.0.9.RELEASE).
@OlgaMaciaszek
After try out with Spring Boot Starter 2.0.9.RELEASE
the console show :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient.<init>(Ljava/util/function/Consumer;)V but it does not exist. Its class, org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient, is available from the following locations:
jar:file:/Users/hb/.m2/repository/org/springframework/spring-webflux/5.1.6.RELEASE/spring-webflux-5.1.6.RELEASE.jar!/org/springframework/web/reactive/socket/client/ReactorNettyWebSocketClient.class
It was loaded from the following location:
file:/Users/hb/.m2/repository/org/springframework/spring-webflux/5.1.6.RELEASE/spring-webflux-5.1.6.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient
You've upgraded spring to 5.1.x with boot 2.0.x which isn't compatible. You'd need to use spring 5.0.x
hi , I am use
spring-cloud-gateay
in a service mesh, when start it I have get a error:Dependencies