客户端注册Cannot execute request on any known server解决

在对eureka注册中心服务端添加安全验证后,新版本springcloud出现一个问题就是,在客户端注册到服务中心时报了一个错:Cannot execute request on any known server,重新仔细看了一下官方文档Securing The Eureka Server部分得以解决。

添加安全验证:https://www.cnblogs.com/zrk3/p/springcloud_securing_eurekaserver.html

一、官方文档

url: https://cloud.spring.io/spring-cloud-static/Finchley.SR2/multi/multi_spring-cloud-eureka-server.html#_securing_the_eureka_server

大意(英语不好,见谅):

只需通过Spring -boot-starter- security将Spring Security添加到服务路径中,就可以保护Eureka服务。默认情况下,当Spring Security位于类路径上时,它将要求在每次向应用程序发送请求时都发送一个有效的CSRF令牌。Eureka客户机通常不会拥有一个有效的跨站点请求伪造令牌(CSRF),您需要禁用/ Eureka /**端点的这个请求

2、添加配置文件

在eureka服务工程中添加配置文件:

package com.zrk.config;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @Description:
 * @Author: zrk
 * @Date: 2019/9/12
 */
@EnableWebSecurity
class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().ignoringAntMatchers("/eureka/**");
        super.configure(http);
    }
}

重启eureka服务,重启客户端就发现已经可以注册成功。

原文地址:https://www.cnblogs.com/zrk3/p/springcloud_securing_bug.html

时间: 2024-08-26 01:10:31

客户端注册Cannot execute request on any known server解决的相关文章

SpringCloud报错:com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

启动SpringCloudEureka 报错:com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server 解决方法: 先仔细检查,指定的注册中心 eureka.client.serviceUrl.defaultZone的地址是否正确,端口号有没有写错.然后,在application.yml 添加以下配置: #Eureka服务注册中心也会将自己作为客户端来

携程apollo源码在idea中启动报错TransportException: Cannot execute request on any known server

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) at com.sun.jersey.api.client.filter.GZIPConte

关于Eureka客户端连接服务端报错问题Cannot execute request on any known server

对于Eureka包这个错误问题:Cannot execute request on any known server,总的原因就是连接Eureka连接服务端的Url地址不对,Url地址不对很很多情况. 一.比如服务端自己连接自己报错,也就是说你可能忘记在eureka服务中配置如下代码. 默认都是开启的. eureka.client.registerWithEureka=false eureka.client.fetchRegistry=false 二.可能是你的配置的去服务注册中心的地址写错了.

eureka server 集成security,eureka client报错com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

当前Spring Coud 版本(Greenwich.SR2)  Spring Boot版本 (2.1.6.RELEASE) 在eureka server 中集成security后,发现eureka client 去注册的时候报以下错误: ----------------------------------------------------------------------------------------------------------------------------------

springcloud报错Cannot execute request on any known server

启动springcloud服务中心,提示这个错误:Cannot execute request on any known server 网上一般说是修改application.properties配置文件,添加如下内容: eureka.client.registerWithEureka:false eureka.client.fetchRegistry:false 看了一下,我是有这些内容的.然后就各种折腾,后来把端口号从8080改成8088就可以了,昨天用8080还是好的,端口被占用了?好像也

一、Watcher---变更的通知------>客户端注册

Zookeeper 提供的了分布式数据的发布/订阅功能,通过 Watch 机制来实现这种分布式的通知功能. Zookeeper 允许客户端向服务器注册一个Watch监听,当服务端的一些指定的事件触发了这个Watch ,就会向指定的客户端发送一个事件通知来实现分布式通知. 整个Watch的注册和通知过程如图: Zookeeper的 Watcher 机制主要包括客户端现成.客户端 WatchManager.Zookeeper服务器三部分,具体流程是:client 向Zookeeper注册的同时,把W

使用ClientScriptManager向客户端注册脚本

ClientScriptManager在非异步(就是说非AJAX)环境下使用的.如果要在异步环境下注册脚本应该使用ScriptManager的静态方法来注册(ScriptManager兼容异步于非异步环境下注册脚本).ClientScriptManager中注册脚本的方法在ScriptManager中都有一一对应的方法,但是有一些区别,ScriptManager中的方法多了一个参数(多了第一个参数),而且使用ScriptManager来注册脚本不是绝对能注册成功的. .aspx文件代码 <%@ 

简要描述客户端发送的http request header都包含哪些内容

http://blog.csdn.net/albert528108/article/details/21745167 2014-03-21 21:34 10829人阅读 评论(2) 收藏 举报  分类: Socket开发(5)  目录(?)[+] 问题描述: 请简要描述客户端发送的http request header都包含哪些内容? 解答: HTTP Request header 当今web程序的开发技术真是百家争鸣,ASP.NET, PHP, JSP,Perl, AJAX 等等. 无论Web

android aidl通信 RemoteCallbackList客户端注册回调

RemoteCallbackList 声明 public class RemoteCallbackList<E extends IInterface> 情况 在AIDL中客户端向服务端注册一个回调方法时,服务端要考虑客户端是否意外退出(客户端因为错误应用Crash,或者被Kill掉了),服务端还不知道去回调客户端,出现错误 客户端和服务端进程状态 在进程间通信过程中,很可能出现一个进程死亡的情况.如果这时活着的一方不知道另一方已经死了就会出现问题.那我们如何在A进程中获取B进程的存活状态呢?