I used spring-cloud-starter-sleuth in my project. Then when it starts, it will show ClassNotFoundException:brave.propagation.CurrentTraceContext$ScopeDecorator
This is a very beginning project with Spring boot 2.1.2.RELEASE and spring cloud Greenwich.RC2; It ran fine before I add the dependency 'spring-cloud-starter-sleuth';
I start a new project with only spring-cloud-starter-sleuth in it(spring cloud INITIALIZR demo), but it still not work;
The POM is:
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.RC2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</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>
The code is just:
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
and the execption is: Caused by: java.lang.ClassNotFoundException: brave.propagation.CurrentTraceContext$ScopeDecorator at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_191] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_191] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_191] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_191] ... 25 common frames omitted
spring-cloud-starter-sleuth
is missing version! ..and when I apply @amaljoyc solution (2.1.0.RELEASE
) - cannot reproduce/works like charm! – xerx593