3
votes

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.

enter image description here

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?

4

4 Answers

1
votes

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>

1
votes

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.

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

I am not sure the problem is technical , he just need to type the right URL http://localhost:8761/eureka/ NOT http://localhost:8761