Java Hystrix仪表板始终显示加载屏幕
我使用Netflix OSS库开发了微服务应用程序。我在本地主机9091/Hystrix上运行的Hystrix仪表板上面临问题。我想监视Micro service-A和Micro service-B之间的请求度量。端点“hystrix.stream”已注册 hystrix仪表板在加载时卡住,未显示任何结果。 我检查了浏览器,发现jquery错误- 未捕获的TypeError:e.indexOf不是一个似乎是jquery版本问题的函数Java Hystrix仪表板始终显示加载屏幕,java,spring-boot,netflix-eureka,hystrix,hystrix-dashboard,Java,Spring Boot,Netflix Eureka,Hystrix,Hystrix Dashboard,我使用Netflix OSS库开发了微服务应用程序。我在本地主机9091/Hystrix上运行的Hystrix仪表板上面临问题。我想监视Micro service-A和Micro service-B之间的请求度量。端点“hystrix.stream”已注册 hystrix仪表板在加载时卡住,未显示任何结果。 我检查了浏览器,发现jquery错误- 未捕获的TypeError:e.indexOf不是一个似乎是jquery版本问题的函数 我正在使用JDK14版本和SpringBoot2.3进行开发将
我正在使用JDK14版本和SpringBoot2.3进行开发将SpringCloudDependencies版本更新为“Hoxton.SR7”,为我解决了这个问题。
@bob0the0mighty
I am adding code snippet for your reference. This is my springboot main class
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
@EnableHystrixDashboard
public class DramaServiceApplication {
}
My controller looks like :
@GetMapping("/acts")
@com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand(fallbackMethod = "fallbackMethodForGetActor", commandKey = "test-Act", groupKey = "test-Act")
public ActorList getActors() {
ActorList actorList = restTemplate.getForObject("http://actor-service/actor/actorsList", ActorList.class);
return actorList;
}
public ActorList fallbackMethodForGetActor() {
return new ActorList(" Requested Actor page is under maintenance!!");
}
application.yml file looks like :
management:
endpoints:
web:
base-path: /
exposure:
include: hystrix.stream, health, info, metrics
After hitting request multiple times, I am getting hystrix dashboard as "loading" always
and screen looks like
[enter image description here][1]
[1]: https://i.stack.imgur.com/hOeZf.png
JQuery3.4.1的spring云依赖项版本“Hoxton.SR6”存在问题
您可以在此处获得问题和修复的详细信息。
将spring云依赖项版本更新为“Hoxton.SR7”解决了我的问题。 JQuery3.4.1的spring云依赖项版本“Hoxton.SR6”存在问题 您可以在此处获得问题和修复的详细信息。
通过添加以下配置更改解决了此问题:
1.在pom.xml中将Hoxton更新为SR7:
14
Hoxton.SR7
2.在application.yml中添加以下条目:
希斯特里克斯:
仪表板:
代理流允许列表:'*'
管理层:
端点:
网状物:
基本路径:/
暴露:
包括:'*'
3.创建单独的配置Java类:
包com.ibm.traic.controller;
导入org.springframework.boot.web.servlet.ServletRegistrationBean;
导入org.springframework.context.annotation.Bean;
导入org.springframework.context.annotation.Configuration;
导入com.netflix.hystrix.contrib.metrics.eventstream.hystrixmetricstreamservlet;
@配置
公共类HystrixConfig{
@豆子
公共ServletRegistrationBean getServlet(){
HystrixMetricsStreamServlet streamServlet=新的HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean=新的ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings(“/exactor/hystrix.stream”);
registrationBean.setName(“hystrix.stream”);
返回注册bean;
}
}
通过添加以下配置更改解决了此问题:
1.在pom.xml中将Hoxton更新为SR7:
14
Hoxton.SR7
2.在application.yml中添加以下条目:
希斯特里克斯:
仪表板:
代理流允许列表:'*'
管理层:
端点:
网状物:
基本路径:/
暴露:
包括:'*'
3.创建单独的配置Java类:
包com.ibm.traic.controller;
导入org.springframework.boot.web.servlet.ServletRegistrationBean;
导入org.springframework.context.annotation.Bean;
导入org.springframework.context.annotation.Configuration;
导入com.netflix.hystrix.contrib.metrics.eventstream.hystrixmetricstreamservlet;
@配置
公共类HystrixConfig{
@豆子
公共ServletRegistrationBean getServlet(){
HystrixMetricsStreamServlet streamServlet=新的HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean=新的ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings(“/exactor/hystrix.stream”);
registrationBean.setName(“hystrix.stream”);
返回注册bean;
}
}
您可以添加您得到的实际错误吗?在你的帖子中,我假设e是一种没有indexOf的对象,而不是jquery版本问题。你能添加你得到的实际错误吗?从你的帖子中,我假设e是一种没有indexOf的对象,而不是jquery版本问题。
This issue got fixed by adding following configuration changes:
1. Updating Hoxton to SR7 in pom.xml:
<properties>
<java.version>14</java.version>
<spring-cloud.version>Hoxton.SR7</spring-cloud.version>
</properties>
2. Add these entries in application.yml:
hystrix:
dashboard:
proxy-stream-allow-list: '*'
management:
endpoints:
web:
base-path: /
exposure:
include: '*'
3. Creating a separate config Java class:
package com.ibm.drama.controller;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
@Configuration
public class HystrixConfig {
@Bean
public ServletRegistrationBean<HystrixMetricsStreamServlet> getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<HystrixMetricsStreamServlet>(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/actuator/hystrix.stream");
registrationBean.setName("hystrix.stream");
return registrationBean;
}
}