Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: io.opentracing.ScopeManager #37

Closed
rtarasov opened this issue Mar 8, 2019 · 13 comments
Closed

java.lang.NoClassDefFoundError: io.opentracing.ScopeManager #37

rtarasov opened this issue Mar 8, 2019 · 13 comments

Comments

@rtarasov
Copy link

rtarasov commented Mar 8, 2019

Hi Guys!
After installation of either of starters getting a below exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'io.opentracing.contrib.spring.tracer.configuration.TracerRegisterAutoConfiguration': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: io.opentracing.ScopeManager

If I comment out the below @bean annotated method:
@bean
public io.opentracing.Tracer jaegerTracer() {
return new Configuration("spring-boot", new Configuration.SamplerConfiguration(ProbabilisticSampler.TYPE, 1),
new Configuration.ReporterConfiguration())
.getTracer();
}
I get an Exception:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.opentracing.contrib.java.spring.jaeger.starter.ReporterAppender' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=false)}

Spring boot version: 1.5.3
java-spring-jaeger version: 0.2.2

Could you please help?

@geoand
Copy link
Collaborator

geoand commented Mar 8, 2019

Hi @rtarasov

Could we please see your pom.xml of the application that generates the first error?

@rtarasov
Copy link
Author

rtarasov commented Mar 8, 2019

hi Georgios @geoand !

Thank you for the prompt reply.
Below is my pom.xml:


4.0.0

<groupId>com.example</groupId>
<artifactId>demo-opentracing-2nd</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo-opentracing</name>
<description>Demo project for Spring Boot</description>

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>1.5.3.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>

	<dependency>
	  <groupId>io.opentracing.contrib</groupId>
	  <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
	  <version>0.2.2</version>
	</dependency>

	<dependency>
		<groupId>com.uber.jaeger</groupId>
		<artifactId>jaeger-core</artifactId>
		<version>0.18.0</version>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
	</plugins>
</build>

Thank you in advance!

Roman.

@geoand
Copy link
Collaborator

geoand commented Mar 8, 2019

Hi Roman,

Can you please remove

	<dependency>
		<groupId>com.uber.jaeger</groupId>
		<artifactId>jaeger-core</artifactId>
		<version>0.18.0</version>
	</dependency>

and try it out?

That is a pretty old version that is almost certainly incompatible with the what the starter uses (see here)

@rtarasov
Copy link
Author

rtarasov commented Mar 8, 2019

Georgios!

If I comment out that dependency and comment the bean provider method I get:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reporter' defined in class path resource [io/opentracing/contrib/java/spring/jaeger/starter/JaegerAutoConfiguration.class]: Unsatisfied dependency expressed through method 'reporter' parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.opentracing.contrib.java.spring.jaeger.starter.ReporterAppender' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=false)}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
.................................................
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.opentracing.contrib.java.spring.jaeger.starter.ReporterAppender' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=false)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1486)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)

@geoand
Copy link
Collaborator

geoand commented Mar 8, 2019

That's weird. Can you please post your Java Spring configuration?

@rtarasov
Copy link
Author

rtarasov commented Mar 8, 2019

Spring config is empty. Only server.port is present there. I have commented out all bean providers also! So it is bold application!

@geoand
Copy link
Collaborator

geoand commented Mar 8, 2019

Would it be possible to zip it and upload it so I can try it?

@rtarasov
Copy link
Author

rtarasov commented Mar 8, 2019

spring-boot-2.zip

Than you Georgios!
Please find attached!

@geoand
Copy link
Collaborator

geoand commented Mar 8, 2019

Cool, I'll give it a shot

@rtarasov
Copy link
Author

rtarasov commented Mar 8, 2019 via email

@geoand
Copy link
Collaborator

geoand commented Mar 8, 2019

This is a bug in the Spring Boot version that is being used in your app. Basically it's ignoring required = false in @Autowired.

If you update to say 1.5.19.RELEASE, the application should work just fine

@rtarasov
Copy link
Author

rtarasov commented Mar 9, 2019

Thank you Georgios! It works!

@geoand
Copy link
Collaborator

geoand commented Mar 9, 2019

Glad to hear it!

I will close the issue then.

@geoand geoand closed this as completed Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants