LinHeLurking / mirai-news-reporter

一个简单的每日新闻速报/动画速报 mirai-console 插件
GNU Affero General Public License v3.0
82 stars 6 forks source link

无法发送图片 #7

Open Feiyuyu0503 opened 2 years ago

Feiyuyu0503 commented 2 years ago
2021-09-30 11:30:19 V/Bot.3******66: Friend(**********) <- 这是今天的 B 站番剧 ( •̀ ω •́ )✧
2021-09-30 11:30:20 E/Reporter: Exception in coroutine Plugin Reporter of Reporter
java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE
        at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106)
        at java.desktop/java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1181)
        at online.ruin_of_future.reporter.AnimeCrawler.buildImageByteArray(AnimeCrawler.kt:95)
        at online.ruin_of_future.reporter.AnimeCrawler.animeByDate(AnimeCrawler.kt:189)
        at online.ruin_of_future.reporter.AnimeCrawler.animeToday(AnimeCrawler.kt:197)
        at online.ruin_of_future.reporter.ReporterPlugin$onEnable$sendAnimeToTarget$1.invokeSuspend(App.kt:113)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
        at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

运行环境是ubuntu 20.04 aarch64

LinHeLurking commented 2 years ago

无法发送图片应该是 mirai 的问题,我看到 mirai 的论坛上有很多人说了这个事情。

Feiyuyu0503 commented 2 years ago

感谢回复。我的情况似乎不是论坛那样,我这里用其他插件都能正常发送图片,但您的插件是有报错信息,请问这个插件需要有桌面环境吗?

LinHeLurking commented 2 years ago

这个应该跟桌面版本无关,实际上我也是在服务器上用的。我看了下报错信息,貌似是我用的那个 JAVA 的图形库报的错。能否说明一下你使用的 JAVA 版本和环境,我试着去复现一下。

Feiyuyu0503 commented 2 years ago

这个应该跟桌面版本无关,实际上我也是在服务器上用的。我看了下报错信息,貌似是我用的那个 JAVA 的图形库报的错。能否说明一下你使用的 JAVA 版本和环境,我试着去复现一下。

你好

openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 16.0.1+9-Ubuntu-120.04, mixed mode, sharing)
Linux instance-20210528-1836 5.11.0-1017-oracle #18~20.04.1-Ubuntu SMP Fri Aug 27 11:09:43 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
LinHeLurking commented 2 years ago

我在 Ubuntu 20.04 上用 OpenJDK 16 运行了一下,没能重现这个问题。不太清楚是怎么回事。会不会是 AARCH64 的问题呢?

我在网上查到的 JAVA AWT 的错误大多都可以通过安装图形库或者设置 headless 解决。因为我复现不了这个问题所以我有点束手无策了。

Feiyuyu0503 commented 2 years ago

我在 Ubuntu 20.04 上用 OpenJDK 16 运行了一下,没能重现这个问题。不太清楚是怎么回事。会不会是 AARCH64 的问题呢?

我在网上查到的 JAVA AWT 的错误大多都可以通过安装图形库或者设置 headless 解决。因为我复现不了这个问题所以我有点束手无策了。

好的 感谢回复!

yifunxxx commented 2 years ago

确实可以通过设置headless解决,比如:java -Djava.awt.headless=true -jar mcl.jar 这样就可以了