【问题标题】:java.lang.NoSuchMethodError: io.netty.buffer.PooledByteBufAllocator.metric()Lio/netty/buffer/PooledByteBufAllocatorMetric;java.lang.NoSuchMethodError: io.netty.buffer.PooledByteBufAllocator.metric()Lio/netty/buffer/PooledByteBufAllocatorMetric;
【发布时间】:2018-06-02 21:44:16
【问题描述】:

我正在尝试用 spark 运行一个简单的脚本,它给了我

java.lang.NoSuchMethodError: io.netty.buffer.PooledByteBufAllocator.metric()Lio/netty/buffer/PooledByteBufAllocatorMetric;

我在这个帖子上看到了:Spark 2.3.0 netty version issue: NoSuchMethod io.netty.buffer.PooledByteBufAllocator.metric()

但即使在我将较新的 netty 模块添加到我的 pom.xml 之后,我仍然可以看到它。我的 pom.xml 看起来像这样:

 <dependency>
   <groupId>org.apache.spark</groupId>
   <artifactId>spark-core_2.11</artifactId>
   <version>2.3.0</version>
 </dependency>
 <dependency>
   <groupId>io.netty</groupId>
   <artifactId>netty-all</artifactId>
   <version>4.1.17.Final</version>
 </dependency>

我也尝试过使用 spark 2.2.1,但这给了我:

java.lang.IllegalArgumentException:要求失败:只能调用 正在运行的 MetricsSystem 上的 getServletHandlers

所以我有点卡住了,有没有其他配置可以尝试?

【问题讨论】:

  • 在您的pom.xml 中使用netty-all 4.1.17.Final,您应该看不到NoSuchMethodError。也许你可以运行mvn clean compile 再试一次。
  • 你是对的,这个错误已经自行消失了。我现在看到一个不同的错误,谢谢!

标签: java apache-spark


【解决方案1】:

所以这可能会有所帮助。首先,我不是 Java 大佬,这是我第一次涉足 Cassandra/spark。我认为他们从源下载中修复了它,因为现在在 2.3.0 中添加了托管依赖项(我发誓这不像一天前我可能疯了)。我还尝试使用 cassandra 连接器,并且包含这些罐子可能会导致我的问题。无论如何,这是我的 docker 文件的摘录:

#SPARK
ENV SPARK_COMMIT 992447fb30ee9ebb3cf794f2d06f4d63a2d792db
ENV SPARK_VERSION 2.3.0
ENV SPARK_PREFIX /usr
ENV SPARK_HOME /usr/spark-${SPARK_VERSION}
ENV _R_CHECK_FORCE_SUGGESTS_ false
RUN wget http://apache.claz.org/spark/spark-2.3.0/spark-2.3.0.tgz && tar -xzf spark-2.3.0.tgz -C $SPARK_PREFIX

# COPY ./builds/secondpage-spark/pom.xml $SPARK_HOME/pom.xml

RUN cd $SPARK_HOME && ./dev/make-distribution.sh --name custom-spark --pip --tgz -Phive -Phive-thriftserver -Pyarn -Pkubernetes -DskipTests

# SPARK CASSANDRA CONNECTOR
ENV CONNECTOR_COMMIT d8a3eb4
ENV CONNECTOR_HOME /usr/spark-cassandra-connector
RUN git clone https://github.com/datastax/spark-cassandra-connector $CONNECTOR_HOME && \
cd $CONNECTOR_HOME && git checkout $CONNECTOR_COMMIT && \
sbt/sbt doc && \
sbt/sbt package && \
sbt/sbt assembly

那里有一堆无关的东西,因为我一直在往墙上扔东西,这是第一个粘住的东西。所以这可以被清理,或者你可以将它转换为纯 bash,无论你想要什么

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-08
    • 2018-01-04
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多