Springboot+Elasticsearch Error [How to Solve]

Error 1: .dersAbstractElasticsearchRepository: failed to load elasticsearch nodes: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []

The error was reported because a comment was opened in the configuration file application.properties

spring.data.elasticsearch.cluster-name=elasticsearch

spring.data.elasticsearch.cluster-nodes=127.0.0.1:9200

spring.data.elasticsearch.properties.path.logs=./
elasticsearch /log spring.data.elasticsearch.properties.path.logs=./elasticsearch/data

Error 2:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name’Test.ElasticSearchTest’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private inter.ArticleSearchRepository

When the name of each package is modified, that is, after the beginning of the package name is unified, it runs successfully.

The screenshot of the successful operation is as follows:

To summarize the reason: the application.java startup class must be placed in the com package, which is a package in the root directory, and cannot be placed in a package that is parallel to the other three packages. Remember! ! Find the reason all night.
And the following figure is the view structure of the change package.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *