springmavenmicroservicesspring-cloud-sleuthzipkin

mvn build failure: Could not find artifact org.springframework.cloud:spring-cloud-sleuth:pom:1.2.2.BUILD-SNAPSHOT


I'm trying to deploy a microservice from here. The first step is mvn clean package but I meet the following errors:

[INFO] -----------------< fdse.microservice:ts-login-service >-----------------
[INFO] Building ts-login-service 1.0                                     [2/39]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] ts-service-cluster 0.1.0 ........................... SUCCESS [  0.079 s]
[INFO] ts-login-service 1.0 ............................... FAILURE [  0.218 s]
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.553 s
[INFO] Finished at: 2023-08-16T17:03:39+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ts-login-service: Could not resolve dependencies for project fdse.microservice:ts-login-service:jar:1.0: Failed to collect dependencies at myproject.microservices:micro-service-monitoring-core:jar:1.2.2.BUILD-SNAPSHOT: Failed to read artifact descriptor for myproject.microservices:micro-service-monitoring-core:jar:1.2.2.BUILD-SNAPSHOT: Could not find artifact org.springframework.cloud:spring-cloud-sleuth:pom:1.2.2.BUILD-SNAPSHOT -> [Help 1]

I check the pom of myproject.microservices:micro-service-monitoring-core mentioned in the logs and find the following lines:

<?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>myproject.microservices</groupId>
    <artifactId>micro-service-monitoring-core</artifactId>
    <packaging>jar</packaging>
    <name>micro-service-monitoring-core</name>
    <description>micro-service-monitoring-core</description>

    <parent>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-sleuth</artifactId>
        <version>1.2.2.BUILD-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <optional>true</optional>
        </dependency>
...

I guess the reason is the missing of spring-cloud-sleuth 1.2.2.BUILD-SNAPSHOT. I tried to use spring-cloud-starter-sleuth and 1.22.RELEASE, and the building process became a success but when I run the whole system I meet the following errors:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceWebFilter' defined in class path resource
[org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'traceWebFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceFilter' defined in class path resource
[org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'sleuthTracer' defined in class path resource
[org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sleuthTracer' parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zipkinSpanListener' defined in class path resource 
[org/springframework/cloud/sleuth/zipkin/ZipkinAutoConfiguration.class]: Unsatisfied dependency expressed through method 'zipkinSpanListener' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reporter' defined in class path resource 
[org/springframework/cloud/sleuth/zipkin/ZipkinAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter]: Factory method 'reporter' threw exception; nested exception is java.lang.NoClassDefFoundError: zipkin/reporter/Sender

I'd like to know where to get the spring-cloud-sleuth 1.2.2.BUILD-SNAPSHOT or how can I solve the errors occur when starting the system.


Solution

  • Thanks to @M. Deinum.

    I modify it to

        <parent>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth</artifactId>
            <version>1.2.2.RELEASE</version>
            <relativePath>..</relativePath>
        </parent>
    

    and it works now. Sometimes containers of ts-xxx-mongo exit with code 14, try docker system prune and then docker-compose up again.