question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Cloud Sleuth has a required dependency on AspectJ

See original GitHub issue

Adding spring-cloud-sleuth-core to a Spring Boot application leads to the following:

Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive
	at org.springframework.aop.aspectj.AspectJExpressionPointcut.<clinit>(AspectJExpressionPointcut.java:91) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.getPointcut(ReflectiveAspectJAdvisorFactory.java:212) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.getAdvisor(ReflectiveAspectJAdvisorFactory.java:194) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.getAdvisors(ReflectiveAspectJAdvisorFactory.java:126) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.aspectj.annotation.BeanFactoryAspectJAdvisorsBuilder.buildAspectJAdvisors(BeanFactoryAspectJAdvisorsBuilder.java:110) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors(AnnotationAwareAspectJAutoProxyCreator.java:95) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:251) ~[spring-aop-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1141) ~[spring-beans-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1114) ~[spring-beans-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:506) ~[spring-beans-5.2.6.BUILD-20200423.171221-90.jar:5.2.6.BUILD-SNAPSHOT]
	... 36 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.tools.PointcutPrimitive
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_232]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_232]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) ~[na:1.8.0_232]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_232]
	... 47 common frames omitted

Debugging, this is related to the use of @Aspect that requires AspectJ. TraceSchedulingAutoConfiguration is opting-in for AspectJ but does not enforce that with a class check.

I think this should be revisited to either back-off or provide AspectJ by default. I’ve added a condition on my end to back-off if AspectJ isn’t available.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
codefromthecryptcommented, May 12, 2020

we can close this as next release will take it. Thanks @timtebeek and @snicoll

0reactions
timtebeekcommented, May 10, 2020

This issue can likely be closed after https://github.com/spring-cloud/spring-cloud-sleuth/commit/75756fd0926fd842c592f3a4e02299433c1c711d ; The pull request that referenced this issue above was merged to master locally to fix up a last few checkstyle issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Cloud Sleuth
Most features require only a property or dependency change to work. These snippets showcase the value of Spring Cloud Sleuth: Through auto-configuration, ...
Read more >
Spring Cloud Sleuth | Auto Configuration for Distributed Tracing
To implement the project, we need to add starter sleuth dependency in the pom.xml file. Spring cloud sleuth is adding two types of...
Read more >
Spring cloud sleuth + Spring Boot 1.4.0 transitive ...
it looks like spring-boot-sleuth has overridden dependencies, cause Spring Boot 1.4 uses spring 4.3.2.RELEASE. I don't need it, how to avoid ...
Read more >
Spring Cloud Tutorial - Distributed Log Tracing using Sleuth ...
Zipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in service architectures. Features include both the ......
Read more >
How to Build an Effective Logging System Using Aspect and ...
Spring Cloud Sleuth enables distributed tracing. ... To add sleuth dependency to our SpringBoot project, we will need to add the following ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found