无法渲染尤里卡仪表板

时间:2018-04-27 19:30:21

标签: spring-boot netflix-eureka

我正在使用spring boot创建spring eureka独立应用程序服务器。但是当我尝试加载eureka服务器仪表板时,错误页面会随附。

enter image description here

pom.xml是

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd">     4.0.0

<groupId>com.oyeplay</groupId>
<artifactId>service-registry</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>service-registry</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <spring-cloud.version>Finchley.RC1</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

application.yml是

    server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

ServiceRegistryApplication.java是

    package com.oyeplay.serviceregistry;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;


@SpringBootApplication
@EnableEurekaServer
public class ServiceRegistryApplication {

    public static void main(String[] args) {
        SpringApplication.run(ServiceRegistryApplication.class, args);

    }
}

有人能告诉我我犯的错误吗?

4 个答案:

答案 0 :(得分:1)

如果您检查弹簧导板https://spring.io/guides/gs/service-registration-and-discovery/,则会发现同样的事情,即Eureka仪表板未显示。

这可能是由于Spring Boot,Spring Cloud和Netflix Eureka Server库的最新版本发生了变化。似乎文档缺少这一部分。

如果你想真正看到Eureka仪表板,现在只需按照以下方式降级依赖项:

  • Spring boot starter parent:使用<version>1.5.10.RELEASE</version> 而不是<version>2.0.1.RELEASE</version>

  • Spring云版:使用 <spring-cloud.version>Edgware.SR3</spring-cloud.version>代替 <spring-cloud.version>Finchley.RC1</spring-cloud.version>

  • 依赖于Eureka Server:使用 而是<artifactId>spring-cloud-starter-eureka-server</artifactId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>

答案 1 :(得分:0)

确保资源目录下没有“ template”和“ static”文件夹。如果您具有spring-web依赖关系,则将自动创建这两个文件夹。

答案 2 :(得分:0)

  1. 删除静态和模板文件夹
  2. 删除.build文件夹
  3. 运行并转到http://localhost:8761/

答案 3 :(得分:0)

我不确定问题是技术性的,他只需要输入正确的URL http:// localhost:8761 / eureka /不是http:// localhost:8761