无法运行ZipKin服务器与弹簧启动



Zipkin不会启动弹簧启动。当我从服务器端(java)运行应用程序时,它抛出了这个异常(可能是依赖问题,但我找不到它)。我已经尝试了很多方法来解决这个问题,每次遇到困难时都更改了spring版本。

是否需要先启动rabbitmq ?

在春季启动zipkin的最佳方式是什么?

为什么用弹簧靴来运行Zipkin会是个好主意?

pom.xml

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>zipkin-distributed-tracing-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>zipkin-distributed-tracing-server</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.3</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
<version>2.12.9</version>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<version>2.12.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Application.java

package com.example.zipkindistributedtracingserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import zipkin2.server.internal.EnableZipkinServer;
@SpringBootApplication
@EnableEurekaClient
@EnableZipkinServer
public class ZipkinDistributedTracingServerApplication {
public static void main(String[] args) {
SpringApplication.run(ZipkinDistributedTracingServerApplication.class, args);
}
}

application.properties

spring.application.name=zipkin-distributed-tracing-server
server.port=9411
eureka.client.service-url.default-zone=http://localhost:8761/eureka

误差

2022-06-07 11:37:48.608  WARN 4660 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [zipkin2.server.internal.InternalZipkinConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class zipkin2.server.internal.ZipkinServerConfiguration
2022-06-07 11:37:48.612  INFO 4660 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-06-07 11:37:48.628 ERROR 4660 --- [  restartedMain] o.s.b.SpringApplication                  : Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [zipkin2.server.internal.InternalZipkinConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class zipkin2.server.internal.ZipkinServerConfiguration
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:610) ~[spring-context-5.3.20.jar:5.3.20]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:311) ~[spring-context-5.3.20.jar:5.3.20]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250) ~[spring-context-5.3.20.jar:5.3.20]
  1. 将zipkin jar拷贝到src/main/resources
  2. 目录下
  3. <plugin>
    <groupId>com.coderplus.maven.plugins</groupId>
    <artifactId>copy-rename-maven-plugin</artifactId>
    <version>1.0.1</version>
    <executions>
    <execution>
    <id>copy-file</id>
    <phase>verify</phase>
    <goals>
    <goal>copy</goal>
    </goals>
    <configuration>
    <sourceFile>src/main/resources/zipkin-server-2.22.1-exec.jar</sourceFile>
    <destinationFile>${project.build.directory}/${project.build.finalName}.jar</destinationFile>
    </configuration>
    </execution>
    </executions>
    </plugin>
    

相关内容

  • 没有找到相关文章

最新更新