Discord Bot Java(Maven)库未找到,加载失败(com.sedmelluq / lavaplayer)[关闭]

Posted

技术标签:

【中文标题】Discord Bot Java(Maven)库未找到,加载失败(com.sedmelluq / lavaplayer)[关闭]【英文标题】:Discord Bot Java (Maven) Library not found, loading failed (com.sedmelluq / lavaplayer) [closed] 【发布时间】:2020-10-29 22:23:28 【问题描述】:

我用 Java (Eclipse) 编写了一个 Discord 机器人。如果我通过 Eclipse 中的控制台启动它,它可以正常工作。如果我将它导出为“可运行的 JAR 文件”并使用 start.bat 文件启动它,它也可以正常工作。

start.bat:

java -jar NameOfTheFile.jar
pause

但是,我不想让我的计算机永久开启。朋友对此不会有任何问题,因此机器人在他的计算机上运行。 如果 bot 由 start.bat 文件启动,则没有错误消息并且可以正常工作。但是,如果要播放音乐(通过 !play 在语音通道中通过机器人触发),则会出现找不到库(需要播放音乐)的错误...

我有Windows 10 + openjdk版本“11.0.7”2020-04-14 朋友的电脑装有 Windows 7 + 最新的 Java 版本

错误(短版):

[lava-daemon-pool-playback-1-thread-1] INFO com.sedmelluq.lava.common.natives.NativeLibraryLoader - Native library libmpg123-0: loading with filter com.sedmelluq.discord.lavaplayer.natives.ConnectorNativeLibLoader$$Lambda$185/29224482@159940e
[lava-daemon-pool-playback-1-thread-1] ERROR com.sedmelluq.lava.common.natives.NativeLibraryLoader - Native library : loading failed.
java.lang.UnsatisfiedLinkError: Required library was not found
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.extractLibraryFromResources(NativeLibraryLoader.java:128)
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.loadInternal(NativeLibraryLoader.java:113)
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.loadAndRemember(NativeLibraryLoader.java:85)
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.load(NativeLibraryLoader.java:70)
        at com.sedmelluq.discord.lavaplayer.natives.ConnectorNativeLibLoader.loadConnectorLibrary(ConnectorNativeLibLoader.java:21)
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoderLibrary.getInstance(OpusDecoderLibrary.java:14)
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoder.<init>(OpusDecoder.java:20)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.initialiseDecoder(OpusPacketRouter.java:194)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.checkDecoderNecessity(OpusPacketRouter.java:178)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.process(OpusPacketRouter.java:94)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaOpusTrackConsumer.consume(MatroskaOpusTrackConsumer.java:47)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.processFrameInBlock(MatroskaStreamingFile.java:372)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseClusterSimpleBlock(MatroskaStreamingFile.java:336)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseNextCluster(MatroskaStreamingFile.java:321)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:297)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.lambda$process$0(MatroskaAudioTrack.java:40)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:276)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:250)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:39)
        at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:25)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:57)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:49)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:105)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:349)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[lava-daemon-pool-playback-1-thread-1] INFO com.sedmelluq.lava.common.natives.NativeLibraryLoader - Native library connector: loading with filter null
[lava-daemon-pool-playback-1-thread-1] ERROR com.sedmelluq.lava.common.natives.NativeLibraryLoader - Native library : loading failed.
java.lang.UnsatisfiedLinkError: Required library was not found
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.extractLibraryFromResources(NativeLibraryLoader.java:128)
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.loadInternal(NativeLibraryLoader.java:113)
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.loadAndRemember(NativeLibraryLoader.java:85)
        at com.sedmelluq.lava.common.natives.NativeLibraryLoader.load(NativeLibraryLoader.java:70)
        at com.sedmelluq.discord.lavaplayer.natives.ConnectorNativeLibLoader.loadConnectorLibrary(ConnectorNativeLibLoader.java:21)
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoderLibrary.getInstance(OpusDecoderLibrary.java:14)
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoder.<init>(OpusDecoder.java:20)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.initialiseDecoder(OpusPacketRouter.java:194)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.checkDecoderNecessity(OpusPacketRouter.java:178)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.process(OpusPacketRouter.java:94)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaOpusTrackConsumer.consume(MatroskaOpusTrackConsumer.java:47)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.processFrameInBlock(MatroskaStreamingFile.java:372)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseClusterSimpleBlock(MatroskaStreamingFile.java:336)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseNextCluster(MatroskaStreamingFile.java:321)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:297)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.lambda$process$0(MatroskaAudioTrack.java:40)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:276)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:250)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:39)
        at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:25)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:57)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:49)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:105)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:349)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[lava-daemon-pool-playback-1-thread-1] ERROR com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor - Error in playback of Kh2FRFhS7QY
com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something broke when playing the track.
        at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:43)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:117)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:349)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoderLibrary.create(II)J
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoderLibrary.create(Native Method)
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoder.<init>(OpusDecoder.java:21)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.initialiseDecoder(OpusPacketRouter.java:194)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.checkDecoderNecessity(OpusPacketRouter.java:178)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.process(OpusPacketRouter.java:94)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaOpusTrackConsumer.consume(MatroskaOpusTrackConsumer.java:47)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.processFrameInBlock(MatroskaStreamingFile.java:372)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseClusterSimpleBlock(MatroskaStreamingFile.java:336)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseNextCluster(MatroskaStreamingFile.java:321)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:297)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.lambda$process$0(MatroskaAudioTrack.java:40)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:276)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:250)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:39)
        at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:25)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:57)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:49)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:105)
        ... 4 more
Exception in thread "lava-daemon-pool-playback-1-thread-1" java.lang.UnsatisfiedLinkError: com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoderLibrary.create(II)J
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoderLibrary.create(Native Method)
        at com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoder.<init>(OpusDecoder.java:21)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.initialiseDecoder(OpusPacketRouter.java:194)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.checkDecoderNecessity(OpusPacketRouter.java:178)
        at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.process(OpusPacketRouter.java:94)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaOpusTrackConsumer.consume(MatroskaOpusTrackConsumer.java:47)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.processFrameInBlock(MatroskaStreamingFile.java:372)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseClusterSimpleBlock(MatroskaStreamingFile.java:336)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseNextCluster(MatroskaStreamingFile.java:321)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:297)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.lambda$process$0(MatroskaAudioTrack.java:40)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:276)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:250)
        at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:39)
        at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:25)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:57)
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:49)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:105)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:349)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

如有必要,我可以附加 pom.xml。 com.sedmelluq 或 lavaplayer 由以下依赖添加:

<dependency>
  <groupId>com.sedmelluq</groupId>
  <artifactId>lavaplayer</artifactId>
  <version>1.3.50</version>
</dependency>

为什么一切都为我工作,而不是在另一台电脑上?有人可以帮忙吗?谢谢你:)

【问题讨论】:

【参考方案1】:

问题是我朋友的电脑是 32 位系统,而音乐库可能只能在 64 位系统上运行。

【讨论】:

以上是关于Discord Bot Java(Maven)库未找到,加载失败(com.sedmelluq / lavaplayer)[关闭]的主要内容,如果未能解决你的问题,请参考以下文章

Discord Java Bot 没有响应

编译 Java/gradle discord bot

按作者获取角色 - Discord Bot Java

Heroku Discord Bot 可构建但无法正常工作

“DiscordApi 无法解析为类型” Discord Java Eclipse Bot

Java Discord Bot (JDA) 检查是不是固定