Eureka注册服时报错:Root name (‘timestamp‘) does not match expected (‘applications‘) for type `org.springfr
搭环境时搭建Eureka的集群版,EurekaServer启动都正常,服务注册时报错:
Root name ('timestamp') does not match expected ('applications') for type `org.springframework.cloud.netflix.eureka.http.EurekaApplications`
2021-11-25 22:23:35.013 INFO 2248 --- [ restartedMain] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://eureka2.com:7002/eureka02/}, exception=Error while extracting response for type [class org.springframework.cloud.netflix.eureka.http.EurekaApplications] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Root name ('timestamp') does not match expected ('applications') for type `org.springframework.cloud.netflix.eureka.http.EurekaApplications`; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Root name ('timestamp') does not match expected ('applications') for type `org.springframework.cloud.netflix.eureka.http.EurekaApplications`at [Source: (PushbackInputStream); line: 1, column: 2] (through reference chain: org.springframework.cloud.netflix.eureka.http.EurekaApplications["timestamp"]) stacktrace=org.springframework.web.client.RestClientException: Error while extracting response for type [class org.springframework.cloud.netflix.eureka.http.EurekaApplications] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Root name ('timestamp') does not match expected ('applications') for type `org.springframework.cloud.netflix.eureka.http.EurekaApplications`; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Root name ('timestamp') does not match expected ('applications') for type `org.springframework.cloud.netflix.eureka.http.EurekaApplications`at [Source: (PushbackInputStream); line: 1, column: 2] (through reference chain: org.springframework.cloud.netflix.eureka.http.EurekaApplications["timestamp"])at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:120)at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1037)at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1020)at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:778)at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:602)at org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient.getApplicationsInternal(RestTemplateEurekaHttpClient.java:145)at org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient.getApplications(RestTemplateEurekaHttpClient.java:135)at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:121)at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(Redirecting
网上搜了一下发现都说是Eureka加了安全认证(SpringSecurity)导致的,可以使用以下方式解决,但我用下面这种方案并没有解决:
@EnableWebSecurity
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {@Overrideprotected void configure(HttpSecurity http) throws Exception {http.csrf().disable(); //关闭csrfsuper.configure(http); //开启认证}
}
首先我自己本身并没有在项目中引入SpringSecurity相关的Jar,所以是没有WebSecurityConfigurerAdapter相关的类的,而且我尝试引入了SpringSecurity也没办法解决。最后当我仔细对比我的集群版和单机Eureka服务的配置区别,最终发现原来错在application.yml文件中。
最终解决:Eureka服务的defaultZone地址必须要以/eureka结尾,不能以其他内容结尾(无论Server端还是Client端都是)。
错误 application.yml 示例:
eureka:client:service-url:defaultZone: http://eureka1.com:7001/eureka01,http://eureka2.com:7002/eureka02register-with-eureka: truefetch-registry: true
正确的 application.yml 示例:
eureka:client:service-url:defaultZone: http://eureka1.com:7001/eureka,http://eureka2.com:7002/eurekaregister-with-eureka: truefetch-registry: true
Eureka注册服时报错:Root name (‘timestamp‘) does not match expected (‘applications‘) for type `org.springfr相关推荐
- Eureka出现Root name ‘timestamp‘ does not match expected (‘instance‘) for type xxx的错误,如何解决?
出现这个错误的主要原因是在服务注册中心配置了如下内容 然后在其他服务模块的配置文件需要修改为如下内容 也就是其他模块如果想要注册进去就要加上用户名和密码
- 在Spring中注册组件时报错:The fully qualified name of the bean's class, except if it serves only as a parent d
问题:我在注册组件时报错The fully qualified name of the bean's class, except if it serves only as a parent defin ...
- mysql unable to find_centos8.2安装mysql8.0时报错Error:Unable to find a match: mysql-community-server...
centos8.2安装mysql8.0时报错Error:Unable to find a match: mysql-community-server 今天用yum安装mysql8.0时报错信息如下 [ ...
- Eureka服务器端启动时报错:Connection refused :connect
场景 新建第一个Eureka服务器端启动后提示: 实现 打开application.yml配置文件 eureka:client:register-with-eureka: falsefetch-reg ...
- 解决 --- Docker 启动时报错:iptables:No chain/target/match by the name
问题:jenkins的docker containner启动失败,报错:failed programming external connectivity - iptables: No chain/ta ...
- 使用Feign服务远程调用项目启动时报错:Field xxx in xxx required a bean of type xxx that could not be found.
报错: *************************** APPLICATION FAILED TO START ***************************Description:F ...
- 解决yarn安装包时报错:computed integrity doesn‘t match our records
删除yarn.lock文件 执行命令yarn 安装要安装的包 上面亲测可行,下面为推测 删除package.lock npm install
- SpringCloud——Eureka注册中心搭建
Eureka原理 eureka来源于古希腊词汇,意为"发现了" eureka分为两部分,Server端和Client端 Register 服务注册 想要参与服务注册发现的实例首先需 ...
- 解决ubuntu中连接mysql时报错:Access denied for user ‘root‘@‘localhost‘
在ubuntu安装好mysql后无脑的跟着别人的博客配置了远程访问的权限,然后在连接时报错: itcast@itcast-virtual-machine:/usr/share/mysql$ mysql ...
最新文章
- 0x14.基础数据结构 — hash表与字符串hash
- SQL与NoSQL区别-读写性能
- 【面试】上中断和下中断
- java增强型for循环(三种遍历集合方式)
- jQuery 判断是否为数字的方法 及 转换数字函数
- fotify php审计,代码安全审计(二)Fortify介绍及使用教程
- C# RichTextBox 做简单的HTML代码编辑器 ---------左侧显示行号
- Laravel源码解析之Console内核
- Python学习笔记:模块与包
- 微课|中学生可以这样学Python(7.3.3节):成员方法、类方法、静态方法
- 视频监控物联卡有什么作用
- 矢量网络分析仪(矢网)的校准
- MySQL 修改frm文件_mysql 之 frm+ibd文件还原data
- 在250美元5天城市
- java代码如何运行?
- 计算机累加器有加法器功能吗,累加器是什么_累加器的作用及原理介绍
- fir.im Weekly - 除了写代码,还需要了解什么
- C4996:'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead.
- 摘自:《设计心理学3:情感设计》 — 〔美〕唐纳德·A·诺曼(Donald Arthur Norman)
- python发票打印程序_用python打印正确的票据生成程序