启动Spring Boot Eureka Server时出错

时间:2016-06-12 17:53:08

标签: spring-boot spring-cloud

尝试部署具有服务发现模块的弹出启动微服务项目时,我收到以下错误

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:
run (default-cli) on project serviceDiscovery: An exception occurred while running. null: 
InvocationTargetException: Unable to start embedded container; 
nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: 
Unable to start embedded Tomcat: Failed to start component [StandardServer[-1]]: 
Failed to start component [StandardService[Tomcat]]: 
Failed to start component [StandardEngine[Tomcat]]: 
A child container failed during start -> 

我发布了我正在使用的pom.xml          http://maven.apache.org/xsd/maven-4.0.0.xsd">         4.0.0

    <groupId>in.service</groupId>
    <artifactId>serviceDiscovery</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

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

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.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>
            <version>1.1.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

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

问题始于spring-boot-starter-parent版本1.3.2.RELEASE。它开始出现以下错误

[ERROR]     Non-resolvable import POM: Failure to find 
org.springframework.cloud:spring-cloud-sleuth-dependencies:pom:1.0.2.BUILD-SNAPSHOT 
in https://repo.spring.io/snapshot was cached in the local repository, 
resolution will not be reattempted until the update interval of spring-snapshots 
has elapsed or updates are forced 
@ org.springframework.cloud:spring-cloud-dependencies:Brixton.BUILD-SNAPSHOT, 
/home/soumya/.m2/repository/org/springframework/cloud/spring-cloud-dependencies
/Brixton.BUILD-SNAPSHOT/spring-cloud-dependencies-Brixton.BUILD-SNAPSHOT.pom

我想把spring-boot-parent版本增加到1.3.5,但是它给了我一些在开头提供的问题

2 个答案:

答案 0 :(得分:3)

Okk,这是解决方案。 将父母保持为

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

现在添加/修改以下依赖关系管理

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Brixton.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

spring-boot-starter-parent(1.3.5和1.3.2)的两个版本都在工作。 实际上我在我的依赖管理中使用 Brixton.BUILD-SNAPSHOT ,现在已经改为 Brixton.RELEASE

答案 1 :(得分:0)

您可以使用spring-cloud-starter-parent而不是spring-boot-starter-parent。

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