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

Unable to start microservice application with sleuth/zipkin enabled #17487

Closed
1 task
vmartowicz opened this issue Jan 4, 2022 · 7 comments · Fixed by #17615
Closed
1 task

Unable to start microservice application with sleuth/zipkin enabled #17487

vmartowicz opened this issue Jan 4, 2022 · 7 comments · Fixed by #17615

Comments

@vmartowicz
Copy link
Contributor

vmartowicz commented Jan 4, 2022

Overview of the issue

When zipkin maven profile is enabled on microservice application, unable to create taskexecutor bean.

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibase' defined in class path resource [io/github/jhipster/sample/config/LiquibaseConfiguration.class]: Unsatisfied dependency expressed through method 'liquibase' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutor' defined in class path resource [io/github/jhipster/sample/config/AsyncConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.concurrent.Executor]: Illegal arguments to factory method 'getAsyncExecutor'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:445)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
at io.github.jhipster.sample.JhipsterSampleMicroserviceApp.main(JhipsterSampleMicroserviceApp.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutor' defined in class path resource [io/github/jhipster/sample/config/AsyncConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.concurrent.Executor]: Illegal arguments to factory method 'getAsyncExecutor'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
... 24 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.concurrent.Executor]: Illegal arguments to factory method 'getAsyncExecutor'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:172)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 38 common frames omitted
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 39 common frames omitted

Motivation for or Use Case

Applcation should start when sleuth/zipkin is enabled

Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)

[email protected]

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@p-caetano
Copy link

p-caetano commented Jan 8, 2022

It seems related with spring-cloud/spring-cloud-sleuth#2094.

Workaround here: spring-projects/spring-framework#27844 (comment)

@vmartowicz
Copy link
Contributor Author

@p-caetano thanks for the response.
Should I understand I need to set the property spring.sleuth.async.enabled to false until spring fixes the bug?
Does it impact the generated jhipster microservice? (not yet tested on my side)

Suggest a Fix

For the first part of the current bug (zipkin version missing), the fix could be to add the zipkin dependency in the BOM I think?

@p-caetano
Copy link

@vmartowicz For my use case, the workaround is ok until a fix is available. You should check yours (https://docs.spring.io/spring-cloud-sleuth/docs/current-SNAPSHOT/reference/html/integrations.html#sleuth-async-annotation-integration).

@deepu105
Copy link
Member

@vmartowicz would you consider doing a PR to add version to BOM

@vmartowicz
Copy link
Contributor Author

vmartowicz commented Jan 14, 2022

@deepu105 After more reading, I think the bug does not come from the BOM.
I think the zipkin maven profile in generated jhipster app should include the folowing dependency spring-cloud-sleuth-zipkin instead of spring-cloud-starter-zipking which was included in spring-cloud-sleuth-dependencies version 2.x but not in 3.x.
In this one it seems to be spring-cloud-sleuth-zipkin.
So I think the fix should be done in the generator. pom.xml should be updated. You confirm?

@deepu105
Copy link
Member

deepu105 commented Jan 14, 2022 via email

@vmartowicz
Copy link
Contributor Author

@deepu105 I m working on it

Regards
Vincent

vmartowicz added a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Jan 19, 2022
vmartowicz added a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Jan 20, 2022
vmartowicz added a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Jan 20, 2022
vmartowicz added a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Jan 21, 2022
vmartowicz added a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Jan 23, 2022
vmartowicz added a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Jan 29, 2022
mshima pushed a commit to vmartowicz/vmz-generator-jhipster that referenced this issue Feb 1, 2022
@pascalgrimaud pascalgrimaud added this to the 7.7.0 milestone Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants