【问题标题】:NoSuchMethodError in Elasticsearch5.x flink connectorElasticsearch5.x flink 连接器中的 NoSuchMethodError
【发布时间】:2017-10-25 16:57:28
【问题描述】:

我在运行我的 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,发现有人遇到了同样的问题,建议是遮住 netty,我将它包含在我的 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>

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

【问题讨论】:

  • 你能发布你的pom吗?
  • 这里是我的 pom 的链接:link
  • 你能把mvn dependency:tree的输出粘贴到包含pom.xml文件的项目目录中吗

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


【解决方案1】:

可能是版本问题。您添加的另一个库中的一个库会覆盖另一个库。我的意思是:您在 pom:a 中有 2 个依赖项,并且 b.dependency a 具有不同版本的 b,因此它会覆盖您添加到 pom 的库 b。

【讨论】:

  • 我没有得到你的建议,但我只有一个 pom。
  • 先找到io.netty.buffer.CompositeByteBuf在哪个jar中。您应该以某种方式找到包含此 io.netty.buffer.CompositeByteBuf 类的依赖项并将其排除。
猜你喜欢
  • 1970-01-01
  • 2016-02-16
  • 2022-12-15
  • 1970-01-01
  • 1970-01-01
  • 2016-09-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多