运行 spring cloud sleuth 错误 mysql impl
error on running spring cloud sleuth with mysql impl
我正在尝试使用默认的 mysql span store 实施 spring 云侦探。
(根据问题修改)
我使用了 Brixton.SR4 和 spring 启动 1.3.7 和 Java 8
服务很简单
@SpringBootApplication
@EnableDiscoveryClient
@EnableZipkinStreamServer
public class TraceCollectionServiceApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(TraceCollectionServiceApplication.class, args);
}
}
pom文件如下:
<?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>com.cisco.phisphere.tracecollectionservice</groupId>
<artifactId>tracecollectionservice</artifactId>
<packaging>jar</packaging>
<name>tracecollectionservice</name>
<description>Distributed Trace Collection Service</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>tracecollectionservice</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
这是application.yml
中的配置
spring:
application:
name: tracecollectionservice
datasource:
schema: classpath:/mysql.sql
url: jdbc:mysql://localhost:3306/test
username: root
# Switch this on to create the schema on startup:
initialize: true
continueOnError: true
driverClassName: com.mysql.jdbc.Driver
sleuth:
enabled: false
zipkin:
storage:
type: mysql
info:
component: Trace Collection Service
app:
name: Trace Collection Service
description: the trace collections service
version: 1.0.0
build:
artifact: com.cisco.phisphere.collectionservice
name: collectionservice
description: This service collections transaction and other things
version: 1.0.0
server:
port: 9411
management:
context-path: /manage
security:
enabled: false
security:
basic:
enabled: false
user:
name: phiuser
password: SecretPassword
eureka:
# these are settings for the client that gets services
client:
# enable these two settings if you want discovery to work
registerWithEureka: true
fetchRegistry: true
serviceUrl:
# we use the secure form having user/password in the main
defaultZone: http://localhost:8761/eureka/
# this describes the actual instance that is registered and parameters around it
instance:
statusPageUrlPath: /manage/info
homePageUrlPath: /manage
healthCheckUrlPath: /manage/health
preferIpAddress: true
aSGName: phisphereCluster
metadataMap:
swaggerEnabled: false
启动时的异常跟踪如下
Exception in thread "ZipkinMySQLStorage-2" java.lang.VerifyError: zipkin/storage/mysql/internal/generated/tables/ZipkinSpans
at zipkin.storage.mysql.MySQLSpanConsumer.accept(MySQLSpanConsumer.java:65)
at zipkin.storage.InternalBlockingToAsyncSpanConsumerAdapter.complete(InternalBlockingToAsyncSpanConsumerAdapter.java:34)
at zipkin.storage.InternalBlockingToAsyncSpanConsumerAdapter.complete(InternalBlockingToAsyncSpanConsumerAdapter.java:32)
at zipkin.storage.InternalCallbackRunnable.run(InternalCallbackRunnable.java:29)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
UI也显示这个错误
我会回答 spring-cloud-dependencies Brixton.SR5...
^^ 将 spring-cloud-sleuth 设置为 1.0。6.RELEASE
^^ 将 zipkin 设置为 1.1.5
^^ 是针对 3.8.2
构建的
现在 spring boot 1.3.7 首先出现,并且(通过 spring-boot-dependencies)将 jooq 设置为 3.7.4,它与 3.8.2 运行时不兼容。
最简单的方法是在你的 pom 中声明 jooq,就像这样..
<!-- For zipkin. Remove when using Spring boot 1.4+ -->
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.8.2</version>
</dependency>
我正在尝试使用默认的 mysql span store 实施 spring 云侦探。
(根据问题修改)
我使用了 Brixton.SR4 和 spring 启动 1.3.7 和 Java 8
服务很简单
@SpringBootApplication
@EnableDiscoveryClient
@EnableZipkinStreamServer
public class TraceCollectionServiceApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(TraceCollectionServiceApplication.class, args);
}
}
pom文件如下:
<?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>com.cisco.phisphere.tracecollectionservice</groupId>
<artifactId>tracecollectionservice</artifactId>
<packaging>jar</packaging>
<name>tracecollectionservice</name>
<description>Distributed Trace Collection Service</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>tracecollectionservice</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
这是application.yml
中的配置spring:
application:
name: tracecollectionservice
datasource:
schema: classpath:/mysql.sql
url: jdbc:mysql://localhost:3306/test
username: root
# Switch this on to create the schema on startup:
initialize: true
continueOnError: true
driverClassName: com.mysql.jdbc.Driver
sleuth:
enabled: false
zipkin:
storage:
type: mysql
info:
component: Trace Collection Service
app:
name: Trace Collection Service
description: the trace collections service
version: 1.0.0
build:
artifact: com.cisco.phisphere.collectionservice
name: collectionservice
description: This service collections transaction and other things
version: 1.0.0
server:
port: 9411
management:
context-path: /manage
security:
enabled: false
security:
basic:
enabled: false
user:
name: phiuser
password: SecretPassword
eureka:
# these are settings for the client that gets services
client:
# enable these two settings if you want discovery to work
registerWithEureka: true
fetchRegistry: true
serviceUrl:
# we use the secure form having user/password in the main
defaultZone: http://localhost:8761/eureka/
# this describes the actual instance that is registered and parameters around it
instance:
statusPageUrlPath: /manage/info
homePageUrlPath: /manage
healthCheckUrlPath: /manage/health
preferIpAddress: true
aSGName: phisphereCluster
metadataMap:
swaggerEnabled: false
启动时的异常跟踪如下
Exception in thread "ZipkinMySQLStorage-2" java.lang.VerifyError: zipkin/storage/mysql/internal/generated/tables/ZipkinSpans
at zipkin.storage.mysql.MySQLSpanConsumer.accept(MySQLSpanConsumer.java:65)
at zipkin.storage.InternalBlockingToAsyncSpanConsumerAdapter.complete(InternalBlockingToAsyncSpanConsumerAdapter.java:34)
at zipkin.storage.InternalBlockingToAsyncSpanConsumerAdapter.complete(InternalBlockingToAsyncSpanConsumerAdapter.java:32)
at zipkin.storage.InternalCallbackRunnable.run(InternalCallbackRunnable.java:29)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
UI也显示这个错误
我会回答 spring-cloud-dependencies Brixton.SR5...
^^ 将 spring-cloud-sleuth 设置为 1.0。6.RELEASE ^^ 将 zipkin 设置为 1.1.5 ^^ 是针对 3.8.2
构建的现在 spring boot 1.3.7 首先出现,并且(通过 spring-boot-dependencies)将 jooq 设置为 3.7.4,它与 3.8.2 运行时不兼容。
最简单的方法是在你的 pom 中声明 jooq,就像这样..
<!-- For zipkin. Remove when using Spring boot 1.4+ -->
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.8.2</version>
</dependency>