Article Directory
1. Problem description
My Spring Boot version is 2.3.4 and Spring Cloud version is Hoxton.SR1.
To integrate zipkin, first import the following dependencies on the server:
<dependencies>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
<version>2.9.4</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<version>2.9.4</version>
</dependency>
</dependencies>
Provide configuration files:
server:
port: 9090
spring:
main:
allow-bean-definition-overriding: true
Then provide the startup class:
@SpringBootApplication
@EnableZipkinServer
public class ZipKinApplication {
public static void main(String[] args) {
SpringApplication.run(ZipKinApplication.class,args);
}
}
Next, run the zipkinserver startup class, and the result is an error:
Copy the entire error message like this:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
zipkin.server.internal.ZipkinHealthIndicator.(ZipkinHealthIndicator.java:26)
The following method did not exist:
org.springframework.boot.actuate.health.CompositeHealthIndicator.(Lorg/springframework/boot/actuate/health/HealthAggregator;)V
The method’s class, org.springframework.boot.actuate.health.CompositeHealthIndicator, is available from the following locations:
jar:file:/D:/Maven/maven_repository/org/springframework/boot/spring-boot-actuator/2.3.4.RELEASE/spring-boot-actuator-2.3.4.RELEASE.jar!/org/springframework/boot/actuate/health/CompositeHealthIndicator.class
The class hierarchy was loaded from the following locations:
org.springframework.boot.actuate.health.CompositeHealthIndicator: file:/D:/Maven/maven_repository/org/springframework/boot/spring-boot-actuator/2.3.4.RELEASE/spring-boot-actuator-2.3.4.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.boot.actuate.health.CompositeHealthIndicator
The general idea is to say that trying to call the non-existent method zipkin.server.internal.ZipkinHealthIndicator method, but the @EnableConfigServer annotation in the startup class is not popular, import zipkin.server.internal.EnableZipkinServer; is no problem in importing:
I say it shining path repeated a jar of The class hierarchy was loaded from the following locations:
the jar package deleted, even eureka result registries are being given a ... ...
The problem is that,The way of integrating zipkin in SpringBoot2.2.x and later versions has changed. It was originally through the @EnablezipkinServer annotation. Now this annotation does not work.
Two, the solution
The server should be integrated by downloading the jar package and then running the jar package. You can choose the version to download at https://dl.bintray.com/openzipkin/maven/io/zipkin/java/zipkin-server/ , choose the suffix -exec.jar (my Spring Boot is 2.3.4, The selected zipkin is 2.12.8, which can be used), then switch to the path where the jar package is located, and then start it with java -jar (the default port number is 9411, so if the zipkin client is provided, you need to The port number in its configuration file is changed to 9411, and the corresponding configuration should be zipkin: base-url: http://localhost:9411):