【报错】ES报错找不到Gson类

报错信息

java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration

Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration] from ClassLoader []

Caused by: java.lang.NoClassDefFoundError: com/google/gson/Gson

Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson

解决

【报错】ES报错找不到Gson类

启动dubbo提供者报错:

发现:es找不到gson的类

将jest的gson排除,重新引入低版本的gson

5.x的jest引入的是2.8x版本的gson

排除后,引入2.6版本的gson,即可,项目顺利运行;

具体是什么原因,尚不明确,希望知道的大佬,能指出;

<dependency>
    <groupId>io.searchbox</groupId>
    <artifactId>jest</artifactId>
    <version>5.3.4</version>
    <exclusions>
        <exclusion>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.6</version>
</dependency>

相关推荐