com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any k

简介: com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any k

Spring Cloud Eureka配置安全验证时Client注册报错com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:829) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:121) ~[eureka-client-1.9.8.jar:1.9.8]
  at com.netflix.discovery.InstanceInfoReplicator$1.run(InstanceInfoReplicator.java:101) [eureka-client-1.9.8.jar:1.9.8]
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_201]
  at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_201]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_201]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_201]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201]
  at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]

当你配置好你的SpringCloudEureka并加上安全验证时,你发现你客户端连接不上你的服务器时候 ,这时候你就要考虑是不是下面两个问题导致你出现这个错误。

1、Spring Cloud Eureka 客户端配置你的服务注册中心时候 没有加上你服务端安全检查的用户名和密码

spring:
  application:
    name: spring-cloud-eureka-client
  #由于我们前面的eureka的服务端加入spring securit的验证配置 所以这里我们需要加上这个配置信息来能够访问
  security:
    user:
      name: root
      password: root
server:
  port: 8761
eureka:
  client:
    service-url:
      #配置eureka服务注册中心地址 如果eureka server服务注册中心是集群部署 只配置一个其他服务注册中心也能发现
      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@eureka1:8861/eureka/

2、未将SpringCloudEureka 中配置的SpringSecurity 的csrf配置信息禁止

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        super.configure(http);
    }
}
目录
相关文章
|
8月前
|
安全 网络安全 数据安全/隐私保护
关于 SAP cloud com.jcraft.jsch.JschException Auth fail for methods password错误消息
关于 SAP cloud com.jcraft.jsch.JschException Auth fail for methods password错误消息
323 0
|
15天前
|
Kubernetes 容器 Perl
k8s部署seata 报错 没有提供足够的身份验证信息 [ http-nio-7091-exec-2] [ty.JwtAuthenticationEntryPoint] [ commence] [] : Responding with unauthorized error. Message - Full authentication is required to access this resource
Kubernetes pod 在16:12时出现两次错误,错误信息显示需要完整认证才能访问资源。尽管有此错误,但页面可正常访问。附有yaml配置文件的图片。
31 2
|
27天前
|
负载均衡 Java 微服务
Java错误:com.netflix.client.ClientException: Load balancer does not have available server for client
Java错误:com.netflix.client.ClientException: Load balancer does not have available server for client
|
1月前
Failed to connect to apiserver: the server has asked for the clieto provide credentials
Failed to connect to apiserver: the server has asked for the clieto provide credentials
12 0
|
8月前
|
Java 微服务
【Java异常】com.netflix.client.ClientException: Load balancer does not have available server for client
【Java异常】com.netflix.client.ClientException: Load balancer does not have available server for client
204 0
|
8月前
|
存储 数据库
关于 SAP AMDP 调用错误消息 client-specific and restricts access to a client
关于 SAP AMDP 调用错误消息 client-specific and restricts access to a client
54 0
|
7月前
|
SQL JavaScript 关系型数据库
Client does not support authentication protocol requested by server
Client does not support authentication protocol requested by server
51 0
|
7月前
|
负载均衡 监控 网络协议
502 Bad Gateway Registered endpoint failed to handle the request
502 Bad Gateway Registered endpoint failed to handle the request
84 1
|
Apache Android开发
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
281 0
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案