1
votes

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

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>

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

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

2

2 Answers

3
votes

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>

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.

0
votes

Can you use spring-cloud-starter-parent instead of 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>