2016-03-28 3 views
3

私はスプリングブートとnetflix ossでマイクロサービス開発を学ぼうとしています。スプリングブートユーレカサーバダッシュボードエラー

私はこのユーレカダッシュボードのエラーで2日間止まってしまいましたが、修正できないようです。助けてください。 私は、単一の検出クライアントのインスタンスを持っていると、サーバーがスタンドアロンモードここ This is how the dashboard looks like

であるが

package com.example; 

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

@SpringBootApplication 
@EnableEurekaServer 

public class EurekaApplication { 

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

confにはapplication.yml

server: 
    port: 8761 

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

bootstrap.ymlをファイルサーバーメインクラスです

spring: 
    application: 
    name: eureka 

のpom.xml

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.example</groupId> 
    <artifactId>demo</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>EurekaApplication</name> 
    <description>Demo project for Spring Boot</description> 

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

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <java.version>1.8</java.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-starter-eureka-server</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</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>Brixton.RC1</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-snapshots</id> 
      <name>Spring Snapshots</name> 
      <url>https://repo.spring.io/snapshot</url> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>spring-milestones</id> 
      <name>Spring Milestones</name> 
      <url>https://repo.spring.io/milestone</url> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 

</project> 
+0

あなたの代わりに春の雲の1のバネブート親ポンポンを使用しない理由はありますか? –

+0

@XtremeBiker私はプロジェクトの作成にspring initializrを使用しましたが、それが問題の原因かもしれませんか? –

+0

わかりませんが、私はそれを試してみましょう。また、あなたは現在ベータ段階にあるBrixton版を使用しています。代わりにAngelと一緒にお試しください。とにかく、Brixtonのあらゆる種類の問題をSpringのメンバーに報告するとよいでしょう。 –

答えて

0

問題は、私のapplication.ymlファイル のserviceURLプロパティ値はタイプミスがあったとしました。私は、httpを含めるのを忘れ://ここでeureka.instance.hostname

が固定YAML

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

である前に、spring-を追加する必要はありませBrixton.RC1

0

で問題はなかったですMバージョンを使用している場合にのみ使用されます。詳細はspring boot official official docを参照してください。あなたのコードはうまくいきます。動作するはずです。取得しているエラーを指定します。ここにpom.xmlがありますと.ymlファイル私は動作して使用している。:

http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0 org.springframework.samples.service.service microservice-デモ 1.1.0.RELEASE 瓶

<parent> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-parent</artifactId> 
    <version>Brixton.RELEASE</version> 
</parent> 

<properties> 
    <!-- Stand-alone RESTFul application for testing only --> 
    <start-class>io.pivotal.microservices.services.Main</start-class> 
</properties> 

<dependencies> 
    <dependency> 
     <!-- Setup Spring Boot --> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter</artifactId> 
    </dependency> 

    <dependency> 
     <!-- Setup Spring MVC & REST, use Embedded Tomcat --> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
    </dependency> 

    <dependency> 
     <!-- Setup Spring Data common components --> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-commons</artifactId> 
    </dependency> 

    <dependency> 
     <!-- Testing starter --> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
    </dependency> 

    <dependency> 
     <!-- Setup Spring Data JPA Repository support --> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-jpa</artifactId> 
    </dependency> 

    <dependency> 
     <!-- In-memory database for testing/demos --> 
     <groupId>org.hsqldb</groupId> 
     <artifactId>hsqldb</artifactId> 
    </dependency> 

    <dependency> 
     <!-- Spring Cloud starter --> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-starter</artifactId> 
    </dependency> 

    <dependency> 
     <!-- Eureka service registration --> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-starter-eureka-server</artifactId> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <goals> 
         <goal>repackage</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

設定し、この検出サーバー

ユーレカ: インスタンス: ホスト名: クライアントはlocalhost:#ないクライアント、自分自身に登録していない registerWithEureka:偽 fetchRegistry:偽

server: 
    port: 1111 # HTTP (Tomcat) port 

# Discovery Server Dashboard uses FreeMarker. Don't want Thymeleaf  templates 
spring: 
    thymeleaf: 
    enabled: false  # Disable Thymeleaf