Elasticsearch5.x flink连接器中的NoSuchMethodError

时间:2017-08-18 13:25:42

标签: java maven elasticsearch apache-flink flink-streaming

我在运行我的flink程序时遇到了一些问题,这是错误:

java.lang.NoSuchMethodError: io.netty.buffer.CompositeByteBuf.addComponents(ZLjava/lang/Iterable;)Lio/netty/buffer/CompositeByteBuf;
    at org.elasticsearch.transport.netty4.Netty4Utils.toByteBuf(Netty4Utils.java:78)
    at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:449)
    at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:91)
    at org.elasticsearch.transport.TcpTransport$ScheduledPing.doRunInLifecycle(TcpTransport.java:261)
    at org.elasticsearch.common.util.concurrent.AbstractLifecycleRunnable.doRun(AbstractLifecycleRunnable.java:67)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:527)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

我看了SO,发现有人有同样的问题,建议是遮阴网,我将它包含在我的pom中:

以下是我添加的内容:

<build>
                <plugins>
                    <!-- disable the exclusion rules -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>2.4.1</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <artifactSet>
                                        <excludes combine.self="override">

                                            <exclude>io.netty:netty-all</exclude>
                                            <exclude>io.netty:netty</exclude>

                                        </excludes>
                                    </artifactSet>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

但问题仍然存在。如果有人有想法,请与我分享,谢谢。

1 个答案:

答案 0 :(得分:0)

可能是版本问题。您添加的另一个库中的库将覆盖另一个库。我的意思是:你在pom中有2个依赖:a和b.dependency a有不同的b版本,所以它覆盖你添加到pom的库b。