You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行Apache Arrow Java示例程序时遇java.lang.NoSuchFieldError: chunkSize错误

解决Apache Arrow Java示例运行时java.lang.NoSuchFieldError: chunkSize错误

错误原因

这是依赖版本冲突引发的问题。从错误堆栈可见,arrow-memory-netty-14.0.2.jar依赖的Netty版本为4.1.104.Final,但项目实际加载的Netty版本与该版本不兼容——PooledByteBufAllocatorL$InnerAllocator类试图访问directArenas[0].chunkSize字段,而该字段在当前使用的Netty版本中已被移除或重命名。

解决方案

方案一:统一Netty版本为Arrow指定版本

在项目构建文件中强制指定Netty版本为4.1.104.Final,确保与Arrow依赖版本一致:

  • Maven(pom.xml):
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.104.Final</version>
        </dependency>
    </dependencies>
</dependencyManagement>
  • Gradle(build.gradle):
dependencies {
    constraints {
        implementation 'io.netty:netty-all:4.1.104.Final'
    }
}

方案二:排除Arrow依赖中的冲突Netty模块

若项目需使用特定版本Netty,可在引入Arrow依赖时排除其自带的Netty相关模块,改用项目统一版本:

<dependency>
    <groupId>org.apache.arrow</groupId>
    <artifactId>arrow-memory-netty</artifactId>
    <version>14.0.2</version>
    <exclusions>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty-buffer</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty-common</artifactId>
        </exclusion>
    </exclusions>
</dependency>

方案三:升级Apache Arrow版本

尝试将Arrow版本升级至更高版本,新版本可能已适配更新的Netty版本,或修复了该依赖冲突问题。

内容的提问来源于stack exchange,提问作者Saravana Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 11:18:11