本文介绍了启动 Spring Boot Eureka 服务器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试部署具有服务发现模块的 Spring Boot 微服务项目时出现以下错误

I am getting the following error while trying to deploy a spring boot microservice project having service discovery module

[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.xmlhttp://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0

I have posted the pom.xml which I am using 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.它开始出现以下错误

The problem started with with spring-boot-starter-parent version 1.3.2.RELEASE. It started giving the following error

[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 但它给我带来了另一组问题,正如开头提供的

I thought of increasing the spring-boot-parent version to 1.3.5 but it gave me another set of problems as provided at the beginning

推荐答案

好的,这里是解决方案.保持父级为

Okk, here is the solution.Keep the parent as

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

现在添加/修改如下依赖管理

Now add / modify the following dependency management

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

Both versions of spring-boot-starter-parent (1.3.5 and 1.3.2) are working.Actually I was using Brixton.BUILD-SNAPSHOT in my dependency-management which has now been changed to Brixton.RELEASE.

这篇关于启动 Spring Boot Eureka 服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 11:48