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

添加Google Storage后Firestore连接报NoSuchFieldError: EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE

解决Firestore连接时java.lang.NoSuchFieldError: EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE错误的提示

核心原因分析

这个错误本质是Netty依赖版本冲突:Google Cloud旗下的Firestore、Storage SDK底层都依赖Netty组件,但不同SDK引入的Netty版本不兼容——EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE是特定版本Netty才有的字段,当项目中同时存在新旧版本Netty时,就会触发该错误。

具体排查与解决步骤

  • 强制统一Netty核心依赖版本
    在pom.xml的dependencyManagement块中声明统一的Netty版本,优先选择Google Cloud SDK兼容的稳定版(比如4.1.90.Final,可根据依赖树调整):

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-all</artifactId>
                <version>4.1.90.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec-http2</artifactId>
                <version>4.1.90.Final</version>
            </dependency>
            <!-- 其他Netty细分包若有冲突,可在此统一版本 -->
        </dependencies>
    </dependencyManagement>
    
  • 定位并排除冲突依赖
    执行Maven命令筛选Netty相关依赖树,找到版本不一致的来源:

    mvn dependency:tree -Dverbose -Dincludes=io.netty
    

    找到冲突根源后,在对应的Google Cloud依赖中排除不兼容的Netty子依赖,例如针对google-cloud-storage:

    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-storage</artifactId>
        <version>你的实际版本号</version>
        <exclusions>
            <exclusion>
                <groupId>io.netty</groupId>
                <artifactId>netty-all</artifactId>
            </exclusion>
            <exclusion>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec-http2</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    
  • 清理本地缓存
    回滚pom.xml后无效,大概率是本地缓存的旧依赖未更新:

    1. 执行Maven强制更新命令:mvn clean install -U
    2. 在IntelliJ中点击File -> Invalidate Caches...,勾选"Clear file system cache and local history"后重启IDE
  • 统一Google Cloud SDK版本
    确保google-cloud-firestore与google-cloud-storage使用同一大版本的SDK,避免跨版本依赖冲突(例如都使用2.20.0这类稳定版,不要混用1.x和2.x版本)。

错误栈验证方向

如果错误栈中出现io.grpc.netty相关类,可直接确认是Netty与gRPC的依赖冲突——gRPC是Firestore、Storage底层通信框架,对Netty版本要求严格,统一版本后问题基本可解决。

内容的提问来源于stack exchange,提问作者Sebastian Lorenzo

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 10:42:41