Closed reallyimeric closed 2 years ago
一旦成功连接到ws后,每收到一条群消息,就可以看到一堆java的错误堆栈信息,并且客户端无法收到message
重现
const socket = new ws.WebSocket('ws://host:port/all?verifyKey=xxxxx&qq=xxxxx')
socket
message
预期行为 没有报错且正常向客户端推送message
错误日志
2022-05-15 14:24:34 V/Bot.xxxxx: [群名字(xxxxx)] 群成员(xxxxxxx) -> 群消息群消息群消息 2022-05-15 14:24:34 W/stderr: Exception in thread "DefaultDispatcher-worker-4" java.lang.reflect.InvocationTargetException: 'void kotlinx.serialization.PolymorphicSerializer.<init>(kotlin.reflect.KClass, java.lang.annotation.Annotation[])' 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.internal.PlatformKt.invokeSerializerOnCompanion(Platform.kt:106) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.internal.PlatformKt.constructSerializerForGivenTypeArgs(Platform.kt:41) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.internal.PlatformKt.compiledSerializerImpl(Platform.kt:23) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.SerializersKt__SerializersKt.serializerOrNull(Serializers.kt:178) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.SerializersKt.serializerOrNull(Unknown Source) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.SerializersKt__SerializersKt.serializer(Serializers.kt:155) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.SerializersKt.serializer(Unknown Source) 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.adapter.internal.serializer.BuiltinJsonSerializer.encodeElement(BuiltinJson.kt:68) 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.adapter.ws.WebsocketAdapter.offerChannel(WebsocketAdapter.kt:98) 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.adapter.ws.WebsocketAdapter.onReceiveBotEvent(WebsocketAdapter.kt:53) 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.context.MahContext$handleBotEvent$1$1.invokeSuspend(MahContext.kt:116) 2022-05-15 14:24:34 W/stderr: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 2022-05-15 14:24:34 W/stderr: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 2022-05-15 14:24:34 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)2022-05-15 14:24:34 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 2022-05-15 14:24:34 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 2022-05-15 14:24:34 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 2022-05-15 14:24:34 W/stderr: Caused by: java.lang.NoSuchMethodError: 'void kotlinx.serialization.PolymorphicSerializer.<init>(kotlin.reflect.KClass, java.lang.annotation.Annotation[])' 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.adapter.internal.dto.EventDTO$Companion$$cachedSerializer$delegate$1.invoke(base.kt:16) 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.adapter.internal.dto.EventDTO$Companion$$cachedSerializer$delegate$1.invoke(base.kt:16) 2022-05-15 14:24:34 W/stderr: at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107) 2022-05-15 14:24:34 W/stderr: at net.mamoe.mirai.api.http.adapter.internal.dto.EventDTO$Companion.serializer(base.kt:16) 2022-05-15 14:24:34 W/stderr: at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) 2022-05-15 14:24:34 W/stderr: at java.base/java.lang.reflect.Method.invoke(Method.java:577) 2022-05-15 14:24:34 W/stderr: at kotlinx.serialization.internal.PlatformKt.invokeSerializerOnCompanion(Platform.kt:101) 2022-05-15 14:24:34 W/stderr: ... 16 more
版本信息
在websocket连接关闭后,console上不再出现报错
2.5.0 的插件需要升级到 2.11 的core
如何升级Core模块?我使用IDEA构建后没有找到mirai-core-all-****.jar这样的包。
mirai-core-all-****.jar
更新: 使用mcl将core的channel改为beta后执行update问题解决。
一旦成功连接到ws后,每收到一条群消息,就可以看到一堆java的错误堆栈信息,并且客户端无法收到message
重现
const socket = new ws.WebSocket('ws://host:port/all?verifyKey=xxxxx&qq=xxxxx')
socket
的message
事件回调一直不会被调用预期行为 没有报错且正常向客户端推送message
错误日志
版本信息