Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1981 的 bug 并未被修复: NoSuchMethodError when Mirai plugin with Ktor client 2.0.0 is executed #2051

Closed
NoMathExpectation opened this issue May 21, 2022 · 5 comments
Labels
N 优先级: 一般 s:console 子系统: mirai-console t:bug 类型: bug
Milestone

Comments

@NoMathExpectation
Copy link
Contributor

NoMathExpectation commented May 21, 2022

问题描述

#1981 的 bug 并没有被修复,在2.11.0版本仍然报相同的错误。

复现

使用原issue的文件或者获取github源码并编译放入 plugins 文件夹中,控制台输入 test 测试

mirai-core 版本

2.11.0

bot-protocol

IPAD

其他组件版本

No response

系统日志

  14:32:51 [INFO] iTXTech Mirai Console Loader version 1.2.2-60c67fb
  14:32:51 [INFO] https://github.com/iTXTech/mirai-console-loader
  14:32:51 [INFO] This program is licensed under GNU AGPL v3
  14:32:52 [INFO] Fetching Mirai Console Loader Announcement...
  14:32:53 [INFO] Mirai Console Loader Announcement:
Mirai Console Loader 公告栏

如果在图片上传的时候遇到问题请与我们联系 (需要提供图片文件源本)
`- 如 Unsupported image type for ExternalResource *
`  considering use gif/png/bmp/jpg format.
`- Tracker: https://github.com/mamoe/mirai/issues/new/choose

常用资源整合
`- https://mirai.mamoe.net/topic/653

如果无法获取Mirai-Repo信息, 例如启动时出现JSON解析错误
请升级到MCL 2.0 Beta并将 config.json 中的 Mirai-Repo 更改为 https://repo.itxtech.org

  14:32:53 [INFO] Verifying "net.mamoe:mirai-console" v2.11.0
  14:32:53 [INFO] Verifying "net.mamoe:mirai-console-terminal" v2.11.0
  14:32:53 [INFO] Verifying "net.mamoe:mirai-core-all" v2.11.0
  14:32:53 [INFO] Verifying "org.itxtech:mcl-addon" v1.2.2
  14:32:53 [INFO] Verifying "net.mamoe:mirai-api-http" v1.10.0
  14:32:54 [INFO] Verifying "net.mamoe:chat-command" v0.5.1
  14:32:54 [WARN] Package "net.mamoe:mirai-api-http" requires "net.mamoe:mirai-console" version 2.5.0. Current version is 2.11.0
  14:32:54 [WARN] Package "net.mamoe:chat-command" requires "net.mamoe:mirai-console" version 2.0-RC. Current version is 2.11.0
2022-05-21 14:32:55 I/main: Starting mirai-console...
2022-05-21 14:32:55 I/main: Backend: version 2.11.0, built on 2022-05-19 22:08:40.
2022-05-21 14:32:55 I/main: Frontend Terminal: version 2.11.0, provided by Mamoe Technologies
2022-05-21 14:32:55 I/main: Welcome to visit https://mirai.mamoe.net/
2022-05-21 14:32:56 V/main: Loading JVM plugins...
2022-05-21 14:32:56 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-05-21 14:32:56 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-05-21 14:32:56 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-05-21 14:32:56 D/JvmPluginLoader: Maven        local: C:\Users\12966\.m2\repository
2022-05-21 14:32:56 D/JvmPluginLoader: Gradle cache local: C:\Users\12966\.gradle\caches\modules-2\files-2.1
2022-05-21 14:32:56 D/JvmPluginLoader: Remote server: [https://maven.aliyun.com/repository/public]
2022-05-21 14:32:56 V/JvmPluginLoader: Plugin shared libraries: D:\Program Files (x86)\Mirai\plugin-shared-libraries
2022-05-21 14:32:56 D/JvmPluginLoader: Peek D:\Program Files (x86)\Mirai\plugin-shared-libraries\libraries.txt in shared libraries
2022-05-21 14:32:56 D/JvmPluginLoader: Skipped D:\Program Files (x86)\Mirai\plugin-shared-libraries\libraries.txt because extension <txt> != jar
2022-05-21 14:32:56 V/JvmPluginLoader: Linking static shared libraries....
2022-05-21 14:32:56 V/JvmPluginLoader: Loading plugin Chat Command v0.5.0
2022-05-21 14:32:56 I/plugin: Successfully loaded plugin Chat Command v0.5.0
2022-05-21 14:32:56 V/JvmPluginLoader: Loading plugin NoMathExpectation.ktorInstallTest v1.0-SNAPSHOT
2022-05-21 14:32:56 I/plugin: Successfully loaded plugin NoMathExpectation.ktorInstallTest v1.0-SNAPSHOT
2022-05-21 14:32:56 V/JvmPluginLoader: Loading plugin MCL Addon v1.2.2
2022-05-21 14:32:56 I/plugin: Successfully loaded plugin MCL Addon v1.2.2
2022-05-21 14:32:56 V/JvmPluginLoader: Loading plugin messageSender v1.0
2022-05-21 14:32:56 I/plugin: Successfully loaded plugin messageSender v1.0
2022-05-21 14:32:56 V/JvmPluginLoader: Loading plugin net.mamoe.mirai-api-http v1.10.0
2022-05-21 14:32:56 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v1.10.0
2022-05-21 14:32:56 V/JvmPluginLoader: Loading plugin mirai-device-generator v1.0.1
2022-05-21 14:32:56 I/plugin: Successfully loaded plugin mirai-device-generator v1.0.1
2022-05-21 14:32:56 V/main: 0 external PluginLoader(s) found.
2022-05-21 14:32:56 V/main: 6 plugin(s) loaded.
2022-05-21 14:32:56 V/main: Loading PermissionService...
2022-05-21 14:32:56 V/main: Reloaded PermissionService settings.
2022-05-21 14:32:56 V/main: Loading built-in commands...
2022-05-21 14:32:56 I/main: Prepared built-in commands: autoLogin, help, login, logout, permission, status, stop
2022-05-21 14:32:56 V/main: Enabling plugins...
2022-05-21 14:32:56 V/JvmPluginLoader: Enabling plugin Chat Command v0.5.0
2022-05-21 14:32:56 V/JvmPluginLoader: Enabled  plugin Chat Command v0.5.0
2022-05-21 14:32:56 V/JvmPluginLoader: Enabling plugin NoMathExpectation.ktorInstallTest v1.0-SNAPSHOT
2022-05-21 14:32:56 I/NoMathExpectation.ktorInstallTest: Ktor install test loaded.
2022-05-21 14:32:56 V/JvmPluginLoader: Enabled  plugin NoMathExpectation.ktorInstallTest v1.0-SNAPSHOT
2022-05-21 14:32:56 V/JvmPluginLoader: Enabling plugin MCL Addon v1.2.2
2022-05-21 14:32:56 I/MCL Addon: iTXTech MCL Version: 1.2.2-60c67fb
2022-05-21 14:32:56 V/JvmPluginLoader: Enabled  plugin MCL Addon v1.2.2
2022-05-21 14:32:56 V/JvmPluginLoader: Enabling plugin messageSender v1.0
2022-05-21 14:32:56 I/messageSender: Plugin loaded
2022-05-21 14:32:56 V/JvmPluginLoader: Enabled  plugin messageSender v1.0
2022-05-21 14:32:56 V/JvmPluginLoader: Enabling plugin net.mamoe.mirai-api-http v1.10.0
2022-05-21 14:32:56 W/net.mamoe.mirai-api-http: USING INITIAL KEY, please edit the key
2022-05-21 14:32:56 I/net.mamoe.mirai-api-http: Starting Mirai HTTP Server in 0.0.0.0:8080
2022-05-21 14:32:56 I/Mirai HTTP API: Http api server is running with authKey: INITKEYL9GTjxQT
2022-05-21 14:32:56 I/net.mamoe.mirai-api-http: 心跳模块启用状态: false
2022-05-21 14:32:56 I/net.mamoe.mirai-api-http: 上报模块启用状态: false
2022-05-21 14:32:56 V/JvmPluginLoader: Enabled  plugin net.mamoe.mirai-api-http v1.10.0
2022-05-21 14:32:56 V/JvmPluginLoader: Enabling plugin mirai-device-generator v1.0.1
2022-05-21 14:32:56 V/JvmPluginLoader: Enabled  plugin mirai-device-generator v1.0.1
2022-05-21 14:32:56 I/main: 6 plugin(s) enabled.
2022-05-21 14:32:56 I/main: mirai-console started successfully.
2022-05-21 14:32:56 E/Mirai HTTP API: java.lang.NoSuchMethodError: 'double kotlin.time.DurationKt.toDuration(int, java.util.concurrent.TimeUnit)'
java.lang.NoSuchMethodError: 'double kotlin.time.DurationKt.toDuration(int, java.util.concurrent.TimeUnit)'
        at mirai-api-http-1.10.0.jar//net.mamoe.mirai.api.http.route.BaseRouteKt$mirai$2.invoke(BaseRoute.kt:48)
        at mirai-api-http-1.10.0.jar//net.mamoe.mirai.api.http.route.BaseRouteKt$mirai$2.invoke(BaseRoute.kt)
        at mirai-api-http-1.10.0.jar//io.ktor.features.CORS$Feature.install(CORS.kt:517)
        at mirai-api-http-1.10.0.jar//io.ktor.features.CORS$Feature.install(CORS.kt:509)
        at mirai-api-http-1.10.0.jar//io.ktor.application.ApplicationFeatureKt.install(ApplicationFeature.kt:68)
        at mirai-api-http-1.10.0.jar//net.mamoe.mirai.api.http.route.BaseRouteKt.mirai(BaseRoute.kt:45)
        at mirai-api-http-1.10.0.jar//net.mamoe.mirai.api.http.MiraiHttpAPIServer$start$2$1$1.invoke(MiraiHttpAPIServer.kt:93)
        at mirai-api-http-1.10.0.jar//net.mamoe.mirai.api.http.MiraiHttpAPIServer$start$2$1$1.invoke(MiraiHttpAPIServer.kt:29)
        at mirai-api-http-1.10.0.jar//io.ktor.server.engine.ApplicationEngineEnvironmentReloading.instantiateAndConfigureApplication(ApplicationEngineEnvironmentReloading.kt:303)
        at mirai-api-http-1.10.0.jar//io.ktor.server.engine.ApplicationEngineEnvironmentReloading.createApplication(ApplicationEngineEnvironmentReloading.kt:138)
        at mirai-api-http-1.10.0.jar//io.ktor.server.engine.ApplicationEngineEnvironmentReloading.start(ApplicationEngineEnvironmentReloading.kt:270)
        at mirai-api-http-1.10.0.jar//io.ktor.server.cio.CIOApplicationEngine$serverJob$1$1.invokeSuspend(CIOApplicationEngine.kt:53)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

> status
Running MiraiConsole v2.11.0, built on 2022-05-19 22:08:40.
Frontend Terminal: version 2.11.0, provided by Mamoe Technologies

Permission Service: Built In Permission Service

Plugins: Chat Command v0.5.0, NoMathExpectation.ktorInstallTest v1.0-SNAPSHOT, MCL Addon v1.2.2, messageSender v1.0, net.mamoe.mirai-api-http v1.10.0, mirai-device-generator v1.0.1

Object Pending Finalization Count: 0
                 committed |  init   |  used   |   max
    Heap Memory:  37.36MB  | 16.0MB  | 30.11MB | 247.5MB
Non-Heap Memory:  29.21MB  | 160.0KB | 28.74MB |   -1
> test
2022-05-21 14:33:05 E/console: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97)
        at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113)
        at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108)
        at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:159)
        at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:112)
        at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1$invokeSuspend$$inlined$runBIO$1.invoke(CoroutineUtils.kt:194)
        at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51)
        at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
        at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.lang.NoSuchMethodError: 'void io.ktor.client.HttpClientConfig.install$default(io.ktor.client.HttpClientConfig, io.ktor.client.plugins.HttpClientPlugin, kotlin.jvm.functions.Function1, int, java.lang.Object)'
        at installTest-1.0-SNAPSHOT.mirai.jar//NoMathExpectation.ktorInstallTest.InstallTest$onEnable$1$handle$1$1.invoke(InstallTest.kt:24)
        at installTest-1.0-SNAPSHOT.mirai.jar//NoMathExpectation.ktorInstallTest.InstallTest$onEnable$1$handle$1$1.invoke(InstallTest.kt:23)
        at io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:41)
        at installTest-1.0-SNAPSHOT.mirai.jar//NoMathExpectation.ktorInstallTest.InstallTest$onEnable$1.handle(InstallTest.kt:23)
        ... 21 more

网络日志

No response

补充信息

No response

@Karlatemp
Copy link
Member

我们需要的是完整console日志,另见 config/Console/Logger.yml

@NoMathExpectation
Copy link
Contributor Author

我们需要的是完整console日志,另见 config/Console/Logger.yml

已补充完整日志

@Karlatemp
Copy link
Member

确认项目使用 buildPlugin 打包?

@NoMathExpectation
Copy link
Contributor Author

确认项目使用 buildPlugin 打包?

是的

@Karlatemp
Copy link
Member

for mamoe
plugin build type: legacy/shadowjar
need to verify console loading / gradle shadowing

@Karlatemp Karlatemp added the s:console 子系统: mirai-console label May 21, 2022
@Karlatemp Karlatemp added this to the 2.12.0-RC milestone May 21, 2022
@Karlatemp Karlatemp added t:bug 类型: bug N 优先级: 一般 labels May 21, 2022
cssxsh pushed a commit to SkyNet1748/mirai that referenced this issue Jul 20, 2022
…er logic

- Drop `io.ktor` in consoleRuntimeClasspath included by `core-api: api(io.ktor)`; Fix mamoe#2051
- Fix IT.plugin-resolve-self-dependencies-over-console-ones
- Fix IT.plugin-use-console-deps-fallback
- Fix plugin dependencies linked to AppClassLoader if any external dependencies used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
N 优先级: 一般 s:console 子系统: mirai-console t:bug 类型: bug
Projects
None yet
Development

No branches or pull requests

2 participants