Well,不要刷屏了

es 与 jackson的问题

Elasticsearch | 作者 ly898197688 | 发布于2018年10月29日 | 阅读数:1010

前面遇到个问题。是ES 集成hive的 问题已经解决。
使用的是 https://www.jianshu.com/p/d9fb7afa634d 方法。
但是现在又遇到ES 的 jackson 问题。报错java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW。
项目中使用的es 是2.4.1   使用的jackson是2.8.1
已邀请:

rochy - rochy_he

赞同来自: ly898197688

还是一样的解决方法,把 ES 依赖的 jackson 添加到 maven-shade-plugin 与 com.google.guava 同级节点下即可
参考我个人的 pom.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/ma ... gt%3B
<modelVersion>4.0.0</modelVersion>

<groupId>net.luculent</groupId>
<artifactId>elastic-guava</artifactId>
<version>1.0.1</version>

<properties>
<elasticsearch.version>2.4.4</elasticsearch.version>
</properties>
<dependencies>
<!--<dependency>-->
<!--<groupId>org.apache.lucene</groupId>-->
<!--<artifactId>lucene-core</artifactId>-->
<!--<version>5.5.2</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>shield</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.google.guava</pattern>
<shadedPattern>net.luculent.elasticsearch.guava</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml.jackson</pattern>
<shadedPattern>net.luculent.elasticsearch.jackson</shadedPattern>
</relocation>
<relocation>
<pattern>org.joda</pattern>
<shadedPattern>net.luculent.elasticsearch.joda</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>net.luculent.elasticsearch.common</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.thirdparty</pattern>
<shadedPattern>net.luculent.elasticsearch.thirdparty</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>elasticsearch-releases</id>
<url>http://maven.elasticsearch.org ... gt%3B
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

</project>

要回复问题请先登录注册