Dituon / petpet

根据模板生成图像
http://d2n.moe/petpet/
GNU Affero General Public License v3.0
313 stars 81 forks source link

触发时出错 #3

Closed shenmo7192 closed 2 years ago

shenmo7192 commented 2 years ago
2022-05-24 13:46:44 W/stderr: javax.imageio.IIOException: Can't read input file!
2022-05-24 13:46:44 W/stderr:   at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1310)
2022-05-24 13:46:44 W/stderr:   at petpet-1.2.jar//xmmt.dituon.ImageSynthesis.sendImage(ImageSynthesis.java:20)
2022-05-24 13:46:44 W/stderr:   at petpet-1.2.jar//xmmt.dituon.Petpet.makeImage(Petpet.java:153)
2022-05-24 13:46:44 W/stderr:   at petpet-1.2.jar//xmmt.dituon.Petpet.onGroupMessage(Petpet.java:71)
2022-05-24 13:46:44 W/stderr:   at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
2022-05-24 13:46:44 W/stderr:   at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43)
2022-05-24 13:46:44 W/stderr:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
2022-05-24 13:46:44 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
2022-05-24 13:46:44 E/main: Exception in coroutine <unnamed>
java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:208)
        at petpet-1.2.jar//xmmt.dituon.Petpet.makeImage(Petpet.java:152)
        at petpet-1.2.jar//xmmt.dituon.Petpet.onGroupMessage(Petpet.java:71)
        at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
        at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
        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)
shenmo7192 commented 2 years ago

1.2

Dituon commented 2 years ago

确保 Mirai/res/petpet 文件夹存在且包含本仓库的图片文件 image ./res 应当和 ./plugins 处于同一级目录下

shenmo7192 commented 2 years ago

ok 我直接git clone了

shenmo7192 commented 2 years ago

确保 Mirai/res/petpet 文件夹存在且包含本仓库的图片文件 image ./res 应当和 ./plugins 处于同一级目录下

2022-05-24 13:59:15 W/stderr: java.lang.NullPointerException: Cannot invoke "javax.imageio.ImageReader.getDefaultReadParam()" because "reader" is null
2022-05-24 13:59:15 W/stderr:     at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1466)
2022-05-24 13:59:15 W/stderr:     at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1365)
2022-05-24 13:59:15 W/stderr:     at petpet-1.2.jar//xmmt.dituon.ImageSynthesis.getAvatarImage(ImageSynthesis.java:131)
2022-05-24 13:59:15 W/stderr:     at petpet-1.2.jar//xmmt.dituon.ImageSynthesis.sendImage(ImageSynthesis.java:70)
2022-05-24 13:59:15 W/stderr:     at petpet-1.2.jar//xmmt.dituon.Petpet.makeImage(Petpet.java:113)
2022-05-24 13:59:15 W/stderr:     at petpet-1.2.jar//xmmt.dituon.Petpet.onNudge(Petpet.java:55)
2022-05-24 13:59:15 W/stderr:     at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
2022-05-24 13:59:15 W/stderr:     at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43)
2022-05-24 13:59:15 W/stderr:     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
2022-05-24 13:59:15 W/stderr:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
2022-05-24 13:59:16 E/main: Exception in coroutine <unnamed>
java.lang.NullPointerException: Cannot invoke "java.awt.image.BufferedImage.getWidth()" because "input" is null
at petpet-1.2.jar//xmmt.dituon.ImageSynthesis.convertCircular(ImageSynthesis.java:111)
at petpet-1.2.jar//xmmt.dituon.ImageSynthesis.sendImage(ImageSynthesis.java:21)
at petpet-1.2.jar//xmmt.dituon.Petpet.makeImage(Petpet.java:171)
at petpet-1.2.jar//xmmt.dituon.Petpet.onNudge(Petpet.java:57)
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
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)
shenmo7192 commented 2 years ago

确保 Mirai/res/petpet 文件夹存在且包含本仓库的图片文件 image ./res 应当和 ./plugins 处于同一级目录下

图片

Dituon commented 2 years ago

确保服务器能正常下载用户头像。 报错方法如下

    public static BufferedImage getAvatarImage(String URL) {
        HttpURLConnection conn = null;
        BufferedImage image = null;
        try {
            java.net.URL url = new URL(URL);
            conn = (HttpURLConnection) url.openConnection();
            image = ImageIO.read(conn.getInputStream());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            assert conn != null;
            conn.disconnect();
        }
        return image;
    }
shenmo7192 commented 2 years ago

是因为没有使用mirai launcher 2.1.1吗

Dituon commented 2 years ago

自行排查问题:

更换网络环境重试。

Dituon commented 2 years ago

尝试使用 1.4 版本排查问题

shenmo7192 commented 2 years ago

尝试使用 1.4 版本排查问题

确实提示获取失败,但是这个链接可被访问

~ $ wget "http://q.qlogo.cn/g?b=qq&nk=1143816631&s=640"
--2022-05-25 16:15:14--  http://q.qlogo.cn/g?b=qq&nk=1143816631&s=640
Resolving q.qlogo.cn... 2402:4e00:1830:12fc:0:93c1:d63f:7ba9, 2402:4e00:1830:12fc:0:93c1:d636:f6e5, 2402:4e00:1830:12fc:0:93c1:d63c:6e70, ...
Connecting to q.qlogo.cn|2402:4e00:1830:12fc:0:93c1:d63f:7ba9|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40277 (39K) [image/jpeg]
Saving to: ‘g?b=qq&nk=1143816631&s=640’

g?b=qq&nk=1143816631&s=640    100%[=================================================>]  39.33K  --.-KB/s    in 0.07s

2022-05-25 16:15:14 (565 KB/s) - ‘g?b=qq&nk=1143816631&s=640’ saved [40277/40277]

版本

  08:15:27 [INFO] iTXTech Mirai Console Loader version 1.2.3-93ac7d8
  08:15:27 [INFO] https://github.com/iTXTech/mirai-console-loader
  08:15:27 [INFO] This program is licensed under GNU AGPL v3

是否是不支持1.2.3?

shenmo7192 commented 2 years ago

报错地点

2022-05-25 08:13:39 I/BlackBE: 捏 @1143816631
2022-05-25 08:13:40 I/stdout: 获取头像失败
2022-05-25 08:13:40 I/stdout: URL: http://q.qlogo.cn/g?b=qq&nk=1143816631&s=640
2022-05-25 08:13:40 W/stderr: java.lang.NullPointerException: Cannot invoke "javax.imageio.ImageReader.getDefaultReadParam()" because "reader" is null
2022-05-25 08:13:40 W/stderr:   at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1466)
2022-05-25 08:13:40 W/stderr:   at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1365)
2022-05-25 08:13:40 W/stderr:   at petpet-1.4.jar//xmmt.dituon.ImageSynthesis.getAvatarImage(ImageSynthesis.java:133)
2022-05-25 08:13:40 W/stderr:   at petpet-1.4.jar//xmmt.dituon.ImageSynthesis.sendImage(ImageSynthesis.java:21)
2022-05-25 08:13:40 W/stderr:   at petpet-1.4.jar//xmmt.dituon.PetData.makeImage(PetData.java:111)
2022-05-25 08:13:40 W/stderr:   at petpet-1.4.jar//xmmt.dituon.Petpet.onGroupMessage(Petpet.java:94)
2022-05-25 08:13:40 W/stderr:   at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
2022-05-25 08:13:40 W/stderr:   at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43)
2022-05-25 08:13:40 W/stderr:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
2022-05-25 08:13:40 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
2022-05-25 08:13:40 E/main: Exception in coroutine <unnamed>
java.lang.NullPointerException: Cannot invoke "java.awt.image.BufferedImage.getWidth()" because "input" is null
        at petpet-1.4.jar//xmmt.dituon.ImageSynthesis.convertCircular(ImageSynthesis.java:113)
        at petpet-1.4.jar//xmmt.dituon.ImageSynthesis.sendImage(ImageSynthesis.java:21)
        at petpet-1.4.jar//xmmt.dituon.PetData.makeImage(PetData.java:111)
        at petpet-1.4.jar//xmmt.dituon.Petpet.onGroupMessage(Petpet.java:94)
        at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
        at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:574)
        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)
Dituon commented 2 years ago

插件使用java8语法,没有使用任何第三方库。

项目对应的mirai版本是 2.9且使用JDK17编译

没有进行过兼容性测试,用新版本重试。

shenmo7192 commented 2 years ago

mirai的版本是 mirai-console-2.11.0.jar 使用的jdk是

~/qbot $ java -version
openjdk version "17-internal" 2021-09-14
OpenJDK Runtime Environment (build 17-internal+0-adhoc..src)
OpenJDK 64-Bit Server VM (build 17-internal+0-adhoc..src, mixed mode)

运行环境

~/qbot $ screenfetch
       ╲ ▁▂▂▂▁ ╱
       ▄███████▄
      ▄██ ███ ██▄
     ▄███████████▄       OS: Android 9
  ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄    Device: vivo X21A (PD1728)
  ██ █████████████ ██    ROM: PKQ1.180819.001 release-keys
  ██ █████████████ ██    Baseband: msm
  ██ █████████████ ██    Kernel: aarch64 Linux 4.4.153-perf+
  ██ █████████████ ██    Uptime:
     █████████████       CPU: Qualcomm Technologies, Inc SDM660
      ███████████        GPU: Qualcomm Technologies, Inc SDM660
       ██     ██         RAM: 2791MiB / 5703MiB
Dituon commented 2 years ago

下个版本 可选择使用二进制字节流读取图片 以尝试解决此问题

应当对 openjdk 进行兼容性测试

mirai的版本是 mirai-console-2.11.0.jar 使用的jdk是

~/qbot $ java -version
openjdk version "17-internal" 2021-09-14
OpenJDK Runtime Environment (build 17-internal+0-adhoc..src)
OpenJDK 64-Bit Server VM (build 17-internal+0-adhoc..src, mixed mode)

运行环境

~/qbot $ screenfetch
       ╲ ▁▂▂▂▁ ╱
       ▄███████▄
      ▄██ ███ ██▄
     ▄███████████▄       OS: Android 9
  ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄    Device: vivo X21A (PD1728)
  ██ █████████████ ██    ROM: PKQ1.180819.001 release-keys
  ██ █████████████ ██    Baseband: msm
  ██ █████████████ ██    Kernel: aarch64 Linux 4.4.153-perf+
  ██ █████████████ ██    Uptime:
     █████████████       CPU: Qualcomm Technologies, Inc SDM660
      ███████████        GPU: Qualcomm Technologies, Inc SDM660
       ██     ██         RAM: 2791MiB / 5703MiB
Dituon commented 2 years ago

已更新 Releases

shenmo7192 commented 2 years ago

已更新 Releases

仍然无法使用。转而使用proot-distro运行了