DreamVoid / MiraiMC

适用于Minecraft服务器的Mirai机器人
https://docs.miraimc.dreamvoid.me
GNU Affero General Public License v3.0
182 stars 15 forks source link

无法通过http-api连接到mcl #374

Closed feikong233 closed 1 year ago

feikong233 commented 1 year ago

问题描述

使用mirai login <qq> <连接密钥> HTTPAPI后报错: 登录机器人时出现异常,原因: me.dreamvoid.miraimc.libraries.org.apache.http.client.ClientProtocolException 无法登录并连接到mcl

已经在同一台机器上启动了MCL,配置文件如下,仅启用了httpapi支持:

general:
  allow-bStats: true
  check-update: true
  disable-safe-warning-message: false
  mirai-working-dir: default
  mirai-core-version: "stable"
  maven-repo-url: "https://maven.aliyun.com/nexus/content/groups/public/"
  enable-http-api: true
  legacy-event-support: false
bot:
  disable-network-logs: false
  disable-bot-logs: false
  use-minecraft-logger:
    bot-logs: true
    network-logs: true
  log-events: true
  contact-cache:
    enable-friend-list-cache: false
    enable-group-member-list-cache: false
    save-interval-millis: 60000
database:
  type: sqlite
  mysql:
    address: localhost
    username: miraimc
    password: miraimc
    database: miraimc
    pool:
      connectionTimeout: 30000
      idleTimeout: 600000
      maxLifetime: 1800000
      maximumPoolSize: 15
      keepaliveTime: 0
      minimumIdle: 5
http-api:
  url: "http://localhost:8080"
  message-fetch:
    interval: 10
    count: 10

复现方法

  1. 启动客户端
  2. 控制台输入mirai login <机器人账号> <连接密钥> HTTPAPI

服务端类型

BungeeCord

服务端版本

Waterfall-1.19-513

MiraiMC 插件版本

1.8-pre1(ci最新构建)

服务端日志

[authlib-injector] [INFO] Logging file: /home/supermc/MinecraftServers/WaterFall-Proxy/authlib-injector.log
[authlib-injector] [INFO] Version: 1.2.1
[authlib-injector] [INFO] Authentication server: http://ddns.smcserver.cn:22090/api/yggdrasil
[authlib-injector] [WARNING] You are using HTTP protocol, which is INSECURE! Please switch to HTTPS if possible.
*** Hey! This build is potentially outdated :( ***
*** Please check for a new build from https://papermc.io/downloads ***
*** Should this build be outdated, you will get NO support for it. ***
[authlib-injector] [INFO] Transformed [net.md_5.bungee.EncryptionUtil] with [BungeeCord Profile Key Transformer]
[12:40:18 INFO]: Using mbed TLS based native cipher.
[12:40:18 INFO]: Using zlib based native compressor.
[12:40:18 INFO]: Enabled Waterfall version git:Waterfall-Bootstrap:1.19-R0.1-SNAPSHOT:13085b9:510
[authlib-injector] [INFO] Httpd is running on port 39755
[authlib-injector] [INFO] Transformed [net.md_5.bungee.connection.InitialHandler] with [Constant URL Transformer]
[12:40:18 INFO]: Not on Windows, attempting to use enhanced EpollEventLoop
[12:40:18 INFO]: Epoll is working, utilising it!
[12:40:18 INFO]: Discovered module: ModuleSpec(name=cmd_alert, file=modules/cmd_alert.jar, provider=JenkinsModuleSource())
[12:40:18 INFO]: Discovered module: ModuleSpec(name=cmd_find, file=modules/cmd_find.jar, provider=JenkinsModuleSource())
[12:40:18 INFO]: Discovered module: ModuleSpec(name=cmd_list, file=modules/cmd_list.jar, provider=JenkinsModuleSource())
[12:40:18 INFO]: Discovered module: ModuleSpec(name=cmd_send, file=modules/cmd_send.jar, provider=JenkinsModuleSource())
[12:40:18 INFO]: Discovered module: ModuleSpec(name=cmd_server, file=modules/cmd_server.jar, provider=JenkinsModuleSource())
[12:40:18 INFO]: Discovered module: ModuleSpec(name=reconnect_yaml, file=modules/reconnect_yaml.jar, provider=JenkinsModuleSource())
[12:40:18 INFO]: Loaded plugin PistonMOTD version 5.0.1 by AlexProgrammerDE
[12:40:18 INFO] [Geyser-BungeeCord]: 正在加载插件...
[12:40:18 INFO] [Geyser-BungeeCord]: 已加载 0 个插件
[12:40:18 INFO]: Loaded plugin Geyser-BungeeCord version 2.1.0-SNAPSHOT by GeyserMC
[12:40:18 INFO]: Loaded plugin reconnect_yaml version git:reconnect_yaml:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:18 INFO]: Loaded plugin cmd_find version git:cmd_find:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:18 INFO] [MiraiMC]: Preparing MiraiMC start-up.
[12:40:18 INFO] [MiraiMC]: Start-up tasks finished.
[12:40:18 INFO] [MiraiMC]: Preparing MiraiMC pre-load.
[12:40:18 INFO] [MiraiMC]: Loading config.
[12:40:18 INFO] [MiraiMC]: Mirai working dir: default
[12:40:18 INFO] [MiraiMC]: Selected mirai core version: stable
[12:40:19 INFO] [MiraiMC]: Verifying mirai-core-all-2.14.0.jar
[12:40:19 INFO] [MiraiMC]: Loading library plugins/MiraiMC/MiraiBot/libs/mirai-core-all-2.14.0.jar
[12:40:19 INFO] [MiraiMC]: Pre-load tasks finished.
[12:40:19 INFO]: Loaded plugin MiraiMC version 1.8-pre1 by DreamVoid
[12:40:19 INFO]: Loaded plugin ViaVersion version 4.5.1 by _MylesC, creeper123123321, Gerrygames, kennytv, Matsv
[12:40:19 INFO]: Loaded plugin cmd_server version git:cmd_server:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:19 INFO]: Loaded plugin XConomy version 2.21.1 by YiC
[12:40:19 INFO]: Loaded plugin cmd_alert version git:cmd_alert:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:19 INFO]: Loading library org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31
[12:40:19 INFO]: Loading library org.jetbrains.kotlin:kotlin-stdlib:1.5.31
[12:40:19 INFO]: Loading library org.jetbrains:annotations:13.0
[12:40:19 INFO]: Loading library org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31
[12:40:19 INFO]: Loading library org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31
[12:40:20 INFO]: Loading library org.apache.commons:commons-jexl3:3.2.1
[12:40:20 INFO]: Loading library redis.clients:jedis:4.2.3
[12:40:20 INFO]: Loading library org.apache.commons:commons-pool2:2.11.1
[12:40:20 INFO]: Loading library com.mojang:datafixerupper:4.0.26
[12:40:20 INFO]: Loading library org.json:json:20211205
[12:40:20 INFO]: Loading library org.yaml:snakeyaml:1.32
[12:40:20 INFO]: Loading library com.typesafe:config:1.4.2
[12:40:20 INFO]: Loading library org.openjdk.nashorn:nashorn-core:15.3
[12:40:20 INFO]: Loading library org.ow2.asm:asm-commons:7.3.1
[12:40:20 INFO]: Loading library org.ow2.asm:asm-tree:7.3.1
[12:40:20 INFO]: Loading library org.ow2.asm:asm:7.3.1
[12:40:20 INFO]: Loading library org.ow2.asm:asm-util:7.3.1
[12:40:20 INFO]: Loading library com.electronwill.night-config:core:3.6.6
[12:40:20 INFO]: Loading library com.electronwill.night-config:toml:3.6.6
[12:40:20 INFO]: Loading library com.electronwill.night-config:json:3.6.6
[12:40:20 INFO]: Loading library com.electronwill.night-config:hocon:3.6.6
[12:40:20 INFO]: Loading library com.zaxxer:HikariCP:4.0.3
[12:40:20 INFO]: Loading library org.slf4j:slf4j-api:2.0.6
[12:40:20 INFO]: Loading library net.kyori:examination-api:1.3.0
[12:40:20 INFO]: Loading library net.kyori:adventure-key:4.11.0
[12:40:20 INFO]: Loading library net.kyori:adventure-api:4.11.0
[12:40:20 INFO]: Loading library net.kyori:examination-string:1.3.0
[12:40:20 INFO]: Loading library net.kyori:adventure-platform-bungeecord:4.1.2
[12:40:20 INFO]: Loading library net.kyori:adventure-text-serializer-gson:4.11.0
[12:40:20 INFO]: Loading library net.kyori:adventure-text-serializer-legacy:4.11.0
[12:40:20 INFO]: Loading library net.kyori:adventure-text-serializer-bungeecord:4.1.2
[12:40:20 INFO]: Loading library net.kyori:adventure-platform-api:4.1.2
[12:40:20 INFO]: Loading library net.kyori:adventure-platform-facet:4.1.2
[12:40:21 INFO]: 
[12:40:21 INFO]: 正在加载 TrChat... git:Waterfall-Bootstrap:1.19-R0.1-SNAPSHOT:13085b9:510
[12:40:21 INFO]: 
[12:40:21 INFO]: [TrChat] 已支持 Bungee 通讯.
[12:40:21 INFO]: Loaded plugin TrChat version 2.0.0-RC-6 by Arasple, ItsFlicker
[12:40:21 INFO]: Loaded plugin cmd_send version git:cmd_send:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:21 INFO]: Loaded plugin cmd_list version git:cmd_list:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:21 WARN]: Forced host server pvp is not defined
[12:40:21 INFO] [PistonMOTD]:   _____  _       _                 __  __   ____  _______  _____  
[12:40:21 INFO] [PistonMOTD]:  |  __ \(_)     | |               |  \/  | / __ \|__   __||  __ \ 
[12:40:21 INFO] [PistonMOTD]:  | |__) |_  ___ | |_  ___   _ __  | \  / || |  | |  | |   | |  | |
[12:40:21 INFO] [PistonMOTD]:  |  ___/| |/ __|| __|/ _ \ | '_ \ | |\/| || |  | |  | |   | |  | |
[12:40:21 INFO] [PistonMOTD]:  | |    | |\__ \| |_| (_) || | | || |  | || |__| |  | |   | |__| |
[12:40:21 INFO] [PistonMOTD]:  |_|    |_||___/ \__|\___/ |_| |_||_|  |_| \____/   |_|   |_____/ 
[12:40:21 INFO] [PistonMOTD]: 
[12:40:21 INFO] [PistonMOTD]: Loading config
[12:40:21 INFO] [PistonMOTD]: Registering placeholders
[12:40:21 INFO] [PistonMOTD]: Looking for hooks
[12:40:21 INFO] [PistonMOTD]: Registering listeners
[12:40:21 INFO] [PistonMOTD]: Registering command
[12:40:21 INFO] [PistonMOTD]: Checking for a newer version
[12:40:22 INFO] [PistonMOTD]: You're up to date!
[12:40:22 INFO] [PistonMOTD]: Loading metrics
[12:40:22 INFO] [PistonMOTD]: Done! :D
[12:40:22 INFO]: Enabled plugin PistonMOTD version 5.0.1 by AlexProgrammerDE
[12:40:22 INFO]: Enabled plugin Geyser-BungeeCord version 2.1.0-SNAPSHOT by GeyserMC
[12:40:22 INFO]: Enabled plugin reconnect_yaml version git:reconnect_yaml:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:22 INFO] [Geyser-BungeeCord]: ******************************************
[12:40:22 INFO] [Geyser-BungeeCord]: 
[12:40:22 INFO]: Enabled plugin cmd_find version git:cmd_find:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:22 INFO] [Geyser-BungeeCord]: 加载 Geyser 中, 版本 2.1.0-SNAPSHOT (git-master-7905581)
[12:40:22 INFO] [Geyser-BungeeCord]: 
[12:40:22 INFO] [MiraiMC]: Preparing MiraiMC post-load.
[12:40:22 INFO] [Geyser-BungeeCord]: ******************************************
[12:40:22 INFO] [MiraiMC]: Initializing SQLite database.
[12:40:22 INFO] [MiraiMC]: Starting Mirai-Event listener.
[12:40:22 INFO] [MiraiMC]: Starting Auto-Login bot.
[12:40:22 WARN] [MiraiMC]: 确保您正在使用开源的 MiraiMC 插件,未知来源的插件可能会盗取您的账号!
[12:40:22 WARN] [MiraiMC]: 请始终从 GitHub 或作者指定的其他途径下载插件: https://github.com/DreamVoid/MiraiMC
[12:40:22 INFO] [MiraiMC-AutoLogin]: Starting auto login task.
[12:40:22 INFO] [MiraiMC]: Some initialization tasks will continue to run afterwards.
[12:40:22 INFO] [MiraiMC]: Post-load tasks finished. Welcome to use MiraiMC!
[12:40:22 INFO] [MiraiMC]: Registering commands.
[12:40:22 INFO] [MiraiMC]: Checking update...
[12:40:22 INFO] [MiraiMC]: Registering events.
[12:40:22 INFO] [MiraiMC]: 你使用的是最新版本的 MiraiMC!
[12:40:22 INFO] [MiraiMC]: Initializing bStats metrics.
[12:40:22 INFO] [MiraiMC]: Initializing HttpAPI async task.
[12:40:22 INFO]: Enabled plugin MiraiMC version 1.8-pre1 by DreamVoid
[12:40:22 INFO] [ViaVersion]: Loading 1.12 -> 1.13 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.13 -> 1.13.2 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.13.2 -> 1.14 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.14 -> 1.15 mappings...
[12:40:22 INFO] [ViaVersion]: Loading block connection mappings ...
[12:40:22 INFO] [ViaVersion]: Loading 1.15 -> 1.16 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.16 -> 1.16.2 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.16.2 -> 1.17 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.17 -> 1.18 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.18 -> 1.19 mappings...
[12:40:22 INFO] [ViaVersion]: Loading 1.19 -> 1.19.3 mappings...
[12:40:22 INFO]: Enabled plugin ViaVersion version 4.5.1 by _MylesC, creeper123123321, Gerrygames, kennytv, Matsv
[12:40:22 INFO] [ViaVersion]: ViaVersion detected lowest supported version by the proxy: 1.8.x (47)
[12:40:22 INFO]: Enabled plugin cmd_server version git:cmd_server:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:22 INFO] [ViaVersion]: Highest supported version by the proxy: 1.19.3 (761)
[12:40:22 INFO] [XConomy]: XConomy successfully enabled!
[12:40:22 INFO] [XConomy]: ===== YiC =====
[12:40:22 INFO]: Enabled plugin XConomy version 2.21.1 by YiC
[12:40:22 INFO]: Enabled plugin cmd_alert version git:cmd_alert:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:22 WARN] [TrChat]: org.bukkit.event.player.PlayerJoinEvent not found, use @Ghost to turn off this warning
[12:40:22 WARN] [TrChat]: org.bukkit.event.player.PlayerQuitEvent not found, use @Ghost to turn off this warning
[12:40:22 WARN] [TrChat]: org.bukkit.event.player.PlayerJoinEvent not found, use @Ghost to turn off this warning
[12:40:22 WARN] [TrChat]: org.bukkit.event.player.PlayerQuitEvent not found, use @Ghost to turn off this warning
[12:40:22 INFO]: [TrChat] 聊天 | 成功载入 1 个聊天频道... [2 Ms]
[12:40:22 INFO]: [TrChat] 信息 | 加载完毕. TrChat v2.0.0-RC-6 现已启用, 敬请使用.
[12:40:22 INFO]: Enabled plugin TrChat version 2.0.0-RC-6 by Arasple, ItsFlicker
[12:40:22 INFO]: Enabled plugin cmd_send version git:cmd_send:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:22 INFO]: Enabled plugin cmd_list version git:cmd_list:1.19-R0.1-SNAPSHOT:13085b9:510 by WaterfallMC
[12:40:22 INFO]: Listening on /0.0.0.0:62000
[12:40:23 INFO] [ViaVersion]: Finished mapping loading, shutting down loader executor!
> [authlib-injector] [INFO] Transformed [org.geysermc.geyser.skin.SkinProvider] with [Constant URL Transformer]
[12:40:23 INFO] [Geyser-BungeeCord]: Geyser正在启动 0.0.0.0:19132
[12:40:23 INFO] [Geyser-BungeeCord]: 完成 (1.229s)! 执行/geyser help 来获取帮助信息!
[12:40:23 WARN] [ViaVersion]: There is a newer plugin version available: 4.6.0, you're on: 4.5.1
[12:40:24 INFO] [MiraiMC]: ========== [ MiraiMC 公告版 ] ==========
[12:40:24 INFO] [MiraiMC]: 1.8-pre1 已发布,支持短信验证码登录,并修复了多个 Bug。
[12:40:24 INFO] [MiraiMC]: 如有需要可更新使用。
[12:40:24 INFO] [MiraiMC]: =======================================
[12:40:24 INFO] [Geyser-BungeeCord]: 新的 Geyser 更新已推出,它支持基岩版 1.19.70。在这里下载更新:https://ci.geysermc.org
> mirai login 2408491316 这里是连接密钥,日志里就不放出来了 HTTPAPI
[12:41:21 WARN] [MiraiMC]: 登录机器人时出现异常,原因: me.dreamvoid.miraimc.libraries.org.apache.http.client.ClientProtocolException
[12:41:21 INFO]: 登录机器人时出现异常,请检查控制台输出!

额外说明

Ubuntu22.04 LTS Java 版本:Openjdk21 无其他插件,多次重载后没有改善

协议

DreamVoid commented 1 year ago

请确认mcl的插件是否只允许https连接