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

BungeeCord插件使用gRPC依赖报connect无效参数异常求助

问题描述

我编写了一款使用gRPC实现服务端连接的Java依赖,该依赖在Spigot插件、普通Java项目中均可正常运行,但在BungeeCord插件中使用时会抛出如下异常:

Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: connect(..) failed: Invalid argument: /www.google.com
Caused by: java.net.ConnectException: connect(..) failed: Invalid argument
     at io.grpc.netty.shaded.io.netty.channel.unix.Errors.newConnectException0(Errors.java:155)
     at io.grpc.netty.shaded.io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128)
     at io.grpc.netty.shaded.io.netty.channel.unix.Socket.connect(Socket.java:312)
     at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect0(AbstractEpollChannel.java:773)
     at io.grpc.netty.shaded.io.netty.channel.epoll.EpollSocketChannel.doConnect0(EpollSocketChannel.java:138)
     at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect(AbstractEpollChannel.java:758)
     at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.connect(AbstractEpollChannel.java:600)
     at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
     at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
     at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
     at io.grpc.netty.shaded.io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:54)
     at io.grpc.netty.shaded.io.grpc.netty.WriteBufferingAndExceptionHandler.connect(WriteBufferingAndExceptionHandler.java:157)
     at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
     at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.access$1000(AbstractChannelHandlerContext.java:61)
     at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext$9.run(AbstractChannelHandlerContext.java:538)
     at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
     at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
     at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:387)
     at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
     at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
     at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
     at java.lang.Thread.run(Thread.java:748)

已尝试方案

  • 使用完全相同及更新版本的Java运行时进行测试,参考同类问题的公开建议方案操作,均未生效。
  • 尝试添加高频率提及的修复JVM参数 -Djava.net.preferIPv4Stack=true,添加后异常变更为:
Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: connect(..) failed: Address family not supported by protocol: /www.google.com
Caused by: java.net.ConnectException: connect(..) failed: Address family not supported by protocol
  • 尝试更换代码运行主机、为gRPC服务端同时开启IPv4与IPv6支持,均无效果。

注:异常信息中的www.google.com仅为占位符,并非实际连接地址。

问题猜想

  • 由于该依赖在其余所有项目环境下均可正常运行,怀疑问题与BungeeCord运行环境有关。初步排查显示BungeeCord本身未使用gRPC(该结论可能存在偏差)。
  • 尝试通过Maven重定位io.grpc.netty.shaded.io.netty包未生效,推测该包本身已经完成过重定位,常规重定位操作不生效。
  • 经过两天的排查尝试,暂未找到进一步调试的方向,寻求可行解决方案。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.27 23:15:51