错误完整信息

WARN [21:31:08.169] [] [o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - refresh - 559] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rewardIssuanceHandler': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminManager': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esUserDAO' defined in cn.yizhoucp.tianai.api.project.dal.es.dao.EsUserDAO defined in @EnableElasticsearchRepositories declared on TianaiServiceApplication: Cannot resolve reference to bean 'elasticsearchTemplate' while setting bean property 'elasticsearchOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataConfiguration$RestClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate]: Factory method 'elasticsearchTemplate' threw exception; nested exception is java.lang.NoSuchFieldError: LATEST
DEBUG [21:31:08.186] [] [com.aliyun.oss - run - 73] - Shutting down reaper thread.
ERROR [21:31:08.215] [] [o.s.boot.SpringApplication - reportFailure - 837] - Application run failed

刚开始以为是bean加载不了,看下Idea语法也没有报错,网上找了一波 Spring boot2.x + Elasticsearch7.x 才想起引入了分词依赖

<dependency>
    <groupId>com.jianggujin</groupId>
    <artifactId>IKAnalyzer-lucene</artifactId>
    <version>4.1.0</version>
</dependency>

可能有比较老的jar包冲突了。查了一下文档,发现lucene-core未引入,果断引入解决问题
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>8.8.1</version>
</dependency>

Comments are closed.

Post Navigation