这种Jpa的错误查找错误出处,错误详情如下

ERROR [12:01:12.102] [1da1d72f575b4f95af5e0cdde8b114e1] [192847] [1] [] [100] [2.28.1] [o.h.e.jdbc.spi.SqlExceptionHelper – logExceptions – 142] – Table ‘tp.video’ doesn’t exist
ERROR [12:01:12.107] [1da1d72f575b4f95af5e0cdde8b114e1] [192847] [1] [] [100] [2.28.1] [c.y.m.c.b.util.RestBusinessTemplate – doExecuteWithoutTransaction – 79] – execute error x
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet

重点:

ERROR [12:01:12.102] [1da1d72f575b4f95af5e0cdde8b114e1] [192847] [1] [] [100] [2.28.1] [o.h.e.jdbc.spi.SqlExceptionHelper – logExceptions – 142] – Table ‘tp.video’ doesn’t exist

有的时候是字段对不上,有的时候是表不存在,直接创建即可

错误完整信息

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>