A problem encountered when starting the springboot project to connect to the elasticsearch index library: Error creating bean with name'elasticsearchClient' define

(A problem encountered when starting the springboot project to connect to the elasticsearch index library: Error creating bean with name'elasticsearchClient' defined in class path resource)

  • I recently set up a project to use SpringBoot to integrate Spring Data JPA; I plan to use SpringCloud in the future; In addition, I have introduced a search engine (index library) in the project. I have worked on solr before, this time I plan to try elasticsearch. I encountered a problem in the middle and pondered It took more than half an hour to solve the problem. Record it

Error content:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘elasticsearchClient’ defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method ‘elasticsearchClient’ threw exception; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings B u i l d e r . p u t ( L j a v a / u t i l / D i c t i o n a r y ; ) L o r g / e l a s t i c s e a r c h / c o m m o n / s e t t i n g s / S e t t i n g s Builder.put(Ljava/util/Dictionary;)Lorg/elasticsearch/common/settings/Settings Builder.put(Ljava/util/Dictionary;)Lorg/elasticsearch/common/settings/SettingsBuilder;Insert picture description here

pom.xml:Insert picture description here

  • I am embarrassed for more than half an hour, the version problem. Delete <version>3.0.6.RELEASE</ version> in pom.xml to solve the problem.

As shown: Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42384113/article/details/106109669