已查明问题,MC的netty版本低于mirai导致出现问题,不过似乎没有什么特别好的解决办法
linglong233 发布的帖子
-
求助:在Java项目中使用MiraiCore2.13.0,但是运行报错
具体情况:把mirai当依赖在Minecraft Bukkit的插件中调用,但是登录时出现报错
报错内容如下[16:32:02 INFO]: 2022-11-30 16:32:02 I/WindowHelperJvm: Mirai 正在使用桌面环境. 如遇到验证码将会弹出对话框. 可添加 JVM 属性 `mirai.no-desktop` 以关闭. [16:32:02 INFO]: 2022-11-30 16:32:02 I/WindowHelperJvm: Mirai is using desktop. Captcha will be thrown by window popup. You can add `mirai.no-desktop` to JVM properties (-Dmirai.no-desktop) to disable it. [16:32:05 INFO]: 2022-11-30 16:32:05 W/Net 614588342: Exception in resumeConnection. NettyChannelException(message=null, cause=java.nio.channels.UnresolvedAddressException) at net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler.createConnection$suspendImpl(NettyNetworkHandler.kt:116) at net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler$createConnection$1.invokeSuspend(NettyNetworkHandler.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Caused by: java.nio.channels.UnresolvedAddressException at sun.nio.ch.Net.checkAddress(Net.java:100) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:620) at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:176) at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:169) at io.netty.channel.DefaultChannelPipeline$HeadHandler.connect(DefaultChannelPipeline.java:1008) at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:494) at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:479) at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47) at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:494) at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:479) at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:464) at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:847) at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:198) at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:165) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) at java.lang.Thread.run(Thread.java:748) [16:32:05 INFO]: 2022-11-30 16:32:05 W/Net 614588342: Network selector received exception, closing bot. (NettyChannelException(message=null, cause=java.nio.channels.UnresolvedAddressException)) [16:32:05 INFO]: 2022-11-30 16:32:05 I/Bot 614588342: Bot cancelled: Bot closed [16:32:05 WARN]: Exception in thread "Thread-11" [16:32:05 WARN]: java.nio.channels.UnresolvedAddressException [16:32:05 WARN]: at sun.nio.ch.Net.checkAddress(Net.java:100) [16:32:05 WARN]: at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:620) [16:32:05 WARN]: at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:176) [16:32:05 WARN]: at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:169) [16:32:05 WARN]: at io.netty.channel.DefaultChannelPipeline$HeadHandler.connect(DefaultChannelPipeline.java:1008) [16:32:05 WARN]: at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:494) [16:32:05 WARN]: at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:479) [16:32:05 WARN]: at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47) [16:32:05 WARN]: at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:494) [16:32:05 WARN]: at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:479) [16:32:05 WARN]: at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:464) [16:32:05 WARN]: at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:847) [16:32:05 WARN]: at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:198) [16:32:05 WARN]: at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:165) [16:32:05 WARN]: at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [16:32:05 WARN]: at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) [16:32:05 WARN]: at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [16:32:05 WARN]: at java.lang.Thread.run(Thread.java:748) [16:32:05 WARN]: Suppressed: NettyChannelException(message=null, cause=java.nio.channels.UnresolvedAddressException) [16:32:05 WARN]: at net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler.createConnection$suspendImpl(NettyNetworkHandler.kt:116) [16:32:05 WARN]: at net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler$createConnection$1.invokeSuspend(NettyNetworkHandler.kt) [16:32:05 WARN]: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [16:32:05 WARN]: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) [16:32:05 WARN]: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) [16:32:05 WARN]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) [16:32:05 WARN]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) [16:32:05 WARN]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) [16:32:05 WARN]: [CIRCULAR REFERENCE:java.nio.channels.UnresolvedAddressException]