unable to render eureka dashboard

烈酒焚心 提交于 2020-06-11 05:13:10

问题


I am creating spring eureka standalone application server using spring boot. But when I try to load the eureka server dashboard, error page comes up as attached.

pom.xml is

<?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 is

    server:
  port: 8761

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

ServiceRegistryApplication.java is

    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);

    }
}

Can anyone tell me what mistakes I am making?


回答1:


Make sure that you do not have the "template" and "static" folders under the resources directory. These two folders will be created automatically if you have spring-web dependence.




回答2:


If you check the spring guide https://spring.io/guides/gs/service-registration-and-discovery/ same thing is observed i.e. Eureka dashboard does not show up.

This could be due to the changes in the latest releases for Spring Boot, Spring Cloud, and Netflix Eureka Server libraries. Seems like the documentation is missing this part.

If you want to really see the Eureka dashboard, for now just downgrade the dependencies as follows:

  • Spring boot starter parent: Use <version>1.5.10.RELEASE</version> instead of <version>2.0.1.RELEASE</version>

  • Spring cloud version: Use <spring-cloud.version>Edgware.SR3</spring-cloud.version> instead of <spring-cloud.version>Finchley.RC1</spring-cloud.version>

  • In dependency for Eureka Server: Use <artifactId>spring-cloud-starter-eureka-server</artifactId> instead of <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>




回答3:


  1. delete static and template folder
  2. delete .build folder
  3. run and goto http://localhost:8761/


来源:https://stackoverflow.com/questions/50069134/unable-to-render-eureka-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!