美文网首页
[报错]An attempt was made to call

[报错]An attempt was made to call

作者: QianmianH | 来源:发表于2021-02-23 15:39 被阅读0次

完整报错:

Description:

An attempt was made to call the method org.elasticsearch.client.RestHighLevelClient.<init>(Lorg/elasticsearch/client/RestClientBuilder;)V but it does not exist. Its class, org.elasticsearch.client.RestHighLevelClient, is available from the following locations:

    jar:file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.10/elasticsearch-rest-high-level-client-5.6.10.jar!/org/elasticsearch/client/RestHighLevelClient.class

It was loaded from the following location:

    file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.10/elasticsearch-rest-high-level-client-5.6.10.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RestHighLevelClient

解决:

@SpringBootApplication(
        scanBasePackages = {
                "$packages$"
        },
//加上这行,阻止springboot自己注入对象:
        exclude={ElasticsearchAutoConfiguration.class, RestClientAutoConfiguration.class}
)

相关文章

网友评论

      本文标题:[报错]An attempt was made to call

      本文链接:https://www.haomeiwen.com/subject/qjnrfltx.html