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.

Bean method 'elasticsearchClient' not loaded because auto-configuration 'ElasticsearchAutoConfiguration' was excluded

See original GitHub issue
2017-02-11T16:48:16.697363+00:00 app[web.1]: ***************************
2017-02-11T16:48:16.697364+00:00 app[web.1]: APPLICATION FAILED TO START
2017-02-11T16:48:16.697364+00:00 app[web.1]: ***************************
2017-02-11T16:48:16.697365+00:00 app[web.1]: 
2017-02-11T16:48:16.697366+00:00 app[web.1]: Description:
2017-02-11T16:48:16.697366+00:00 app[web.1]: 
2017-02-11T16:48:16.697367+00:00 app[web.1]: Parameter 0 of method elasticsearchTemplate in no.lavoapp.config.ElasticSearchConfiguration required a bean of type 'org.elasticsearch.client.Client' that could not be found.
2017-02-11T16:48:16.697369+00:00 app[web.1]: 	- Bean method 'elasticsearchClient' not loaded because auto-configuration 'ElasticsearchAutoConfiguration' was excluded
2017-02-11T16:48:16.697369+00:00 app[web.1]: 
2017-02-11T16:48:16.697370+00:00 app[web.1]: 
2017-02-11T16:48:16.697370+00:00 app[web.1]: Action:
2017-02-11T16:48:16.697371+00:00 app[web.1]: 
2017-02-11T16:48:16.697371+00:00 app[web.1]: Consider revisiting the conditions above or defining a bean of type 'org.elasticsearch.client.Client' in your configuration.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
VanRoycommented, Nov 16, 2019

Hi @uuhnaut69 , with SpringDataJest you don’t have access to elasticsearch Client. Do you have try the solution described here : http://stackoverflow.com/questions/39623238/setting-up-bonsai-elasticsearch-in-jhipster-heroku/42206596#42206596 ?

0reactions
jonno85commented, Apr 22, 2020

@VanRoy, after further tries, I realise that it is more an issue with the spring boot Bean initialisation. In the @Service class constructor, passing the JestElasticsearchTemplate jestElasticsearchTemplate, it does not injected properly and cause the error above with the following stacktrace:

2020-04-22 08:58:48.950 DEBUG 9149 — [ restartedMain] reactor.netty.tcp.TcpResources : [http] resources will use the default ConnectionProvider: reactor.netty.resources.PooledConnectionProvider@5a451b76 2020-04-22 08:58:49.038 WARN 9149 — [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘elasticsearchIndexService’ defined in file […/target/classes/com/j/autoinvito/service/ElasticsearchIndexService.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.github.vanroy.springdata.jest.JestElasticsearchTemplate’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2020-04-22 08:58:49.040 INFO 9149 — [ restartedMain] c.h.h.HazelcastCacheRegionFactory : Shutting down HazelcastCacheRegionFactory 2020-04-22 08:58:49.040 WARN 9149 — [ restartedMain] c.h.h.i.IHazelcastInstanceFactory : hibernate.cache.hazelcast.shutdown_on_session_factory_close property is set to ‘false’. Leaving current HazelcastInstance active! (Warning: Do not disable Hazelcast hazelcast.shutdownhook.enabled property!) 2020-04-22 08:58:49.062 INFO 9149 — [ restartedMain] com.hazelcast.core.LifecycleService : [127.0.0.1]:18600 [dev] [3.12.6] [127.0.0.1]:18600 is SHUTTING_DOWN 2020-04-22 08:58:49.066 INFO 9149 — [ restartedMain] com.hazelcast.instance.Node : [127.0.0.1]:18600 [dev] [3.12.6] Shutting down connection manager… 2020-04-22 08:58:49.069 INFO 9149 — [ restartedMain] com.hazelcast.instance.Node : [127.0.0.1]:18600 [dev] [3.12.6] Shutting down node engine… 2020-04-22 08:58:49.074 INFO 9149 — [ restartedMain] com.hazelcast.instance.NodeExtension : [127.0.0.1]:18600 [dev] [3.12.6] Destroying node NodeExtension. 2020-04-22 08:58:49.075 INFO 9149 — [ restartedMain] com.hazelcast.instance.Node : [127.0.0.1]:18600 [dev] [3.12.6] Hazelcast Shutdown is completed in 11 ms. 2020-04-22 08:58:49.075 INFO 9149 — [ restartedMain] com.hazelcast.core.LifecycleService : [127.0.0.1]:18600 [dev] [3.12.6] [127.0.0.1]:18600 is SHUTDOWN 2020-04-22 08:58:49.075 INFO 9149 — [ restartedMain] c.j.a.config.CacheConfiguration : Closing Cache Manager 2020-04-22 08:58:49.077 INFO 9149 — [ restartedMain] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient … 2020-04-22 08:58:52.083 INFO 9149 — [ restartedMain] com.netflix.discovery.DiscoveryClient : Unregistering … 2020-04-22 08:58:52.164 INFO 9149 — [ restartedMain] com.netflix.discovery.DiscoveryClient : DiscoveryClient_UAA/uaa:4eb5931a0c21060509cef4ef6128132c - deregister status: 200 2020-04-22 08:58:52.173 INFO 9149 — [ restartedMain] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient 2020-04-22 08:58:52.435 ERROR 9149 — [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description: Parameter 2 of constructor in com.j.autoinvito.service.ElasticsearchIndexService required a bean of type ‘com.github.vanroy.springdata.jest.JestElasticsearchTemplate’ that could not be found.

Action: Consider defining a bean of type ‘com.github.vanroy.springdata.jest.JestElasticsearchTemplate’ in > your configuration.

Process finished with exit code 0

If instead I use the annotation @Autowired over the JestElasticsearchTemplate object, it does work. So it seems more a priority issue about the order of Spring boot Bean initialisation.

What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Spring Boot - Disable embedded ElasticSearch without ...
If I remove the lines from the POM, my code needs major updates, because all annotations to ES cannot be found anymore. Is...
Read more >
Error creating bean with name 'client' - Elasticsearch
I was trying to integrate elastic search onto spring-boot application but I got this *Error creating bean with name 'client' *Exception, not ......
Read more >
Spring Boot Reference Guide
Spring Boot auto-configuration attempts to automatically configure your Spring application based on the jar dependencies that you have added. For example, If ...
Read more >
springboot整合elasticsearch时的版本问题: - 殇之弑梦 - 博客园
IllegalStateException: Failed to load ApplicationContext at ... autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]: Bean ...
Read more >
Spring boot builds and starts, but no serving happens
(Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.) ...
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