Caused by: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Linux and os.arch=x86_64

huangapple go评论66阅读模式
英文:

Caused by: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Linux and os.arch=x86_64

问题

我想要实现的目标:

使用本地/编译成本地代码/使用GraalVM运行一个Kafka消费者

问题:

在运行应用程序时,我遇到了这个100%可重现的问题:

由于: org.apache.kafka.common.KafkaException: 从my-topic-1接收下一个记录时收到异常。如有必要,请寻找超过该记录以继续消费。
	在 org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.fetchRecords(Fetcher.java:1676)
	在 org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.access$1900(Fetcher.java:1497)
	在 org.apache.kafka.clients.consumer.internals.Fetcher.fetchRecords(Fetcher.java:717)
	在 org.apache.kafka.clients.consumer.internals.Fetcher.collectFetch(Fetcher.java:683)
	在 org.apache.kafka.clients.consumer.KafkaConsumer.pollForFetches(KafkaConsumer.java:1314)
	在 org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1243)
	在 org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1216)
	在 reactor.kafka.receiver.internals.ConsumerEventLoop$PollEvent.run(ConsumerEventLoop.java:357)
	在 reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	在 reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	在 java.base@17.0.7/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	在 java.base@17.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	在 java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	在 java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	在 java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
	在 org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
	在 org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
由于: org.apache.kafka.common.KafkaException: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] 找不到适用于 os.name=Linux 和 os.arch=x86_64 的本地库。
	在 org.apache.kafka.common.compress.SnappyFactory.wrapForInput(SnappyFactory.java:46)
	在 org.apache.kafka.common.record.CompressionType$3.wrapForInput(CompressionType.java:94)
	在 org.apache.kafka.common.record.DefaultRecordBatch.recordInputStream(DefaultRecordBatch.java:276)
	在 org.apache.kafka.common.record.DefaultRecordBatch.compressedIterator(DefaultRecordBatch.java:280)
	在 org.apache.kafka.common.record.DefaultRecordBatch.streamingIterator(DefaultRecordBatch.java:364)
	在 org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.nextFetchedRecord(Fetcher.java:1619)
	在 org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.fetchRecords(Fetcher.java:1656)
	... 16 帧共同组成
由于: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] 找不到适用于 os.name=Linux 和 os.arch=x86_64 的本地库。
	在 org.xerial.snappy.SnappyLoader.findNativeLibrary(SnappyLoader.java:343)
	在 org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:177)
	在 org.xerial.snappy.SnappyLoader.loadSnappyApi(SnappyLoader.java:155)
	在 org.xerial.snappy.Snappy.init(Snappy.java:70)
	在 org.xerial.snappy.Snappy.<clinit>(Snappy.java:47)
	在 org.xerial.snappy.SnappyInputStream.readFully(SnappyInputStream.java:145)
	在 org.xerial.snappy.SnappyInputStream.readHeader(SnappyInputStream.java:99)
	在 org.xerial.snappy.SnappyInputStream.<init>(SnappyInputStream.java:59)
	在 org.apache.kafka.common.compress.SnappyFactory.wrapForInput(SnappyFactory.java:44)
	... 22 帧共同组成

我尝试过的:

在我的依赖项中,我确实有最新版本的Snappy:

<dependency>
	<groupId>org.xerial.snappy</groupId>
	<artifactId>snappy-java</artifactId>
	<version>1.1.9.1</version>
</dependency>

在我的Ubuntu机器上,我已经安装了Snappy。

root@dlp:~# apt -y install snapd
root@dlp:~# systemctl  enable snapd.service snapd.socket
root@dlp:~# source /etc/profile.d/apps-bin-path.sh

问题:

如何修复这个异常?

英文:

What I would like to achieve:

Run a kafka consumer with native / aot / graalvm

Issue:

When running the application, I am facing this 100% reproducible issue:

Caused by: org.apache.kafka.common.KafkaException: Received exception when fetching the next record from my-topic-1. If needed, please seek past the record to continue consumption.
	at org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.fetchRecords(Fetcher.java:1676)
	at org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.access$1900(Fetcher.java:1497)
	at org.apache.kafka.clients.consumer.internals.Fetcher.fetchRecords(Fetcher.java:717)
	at org.apache.kafka.clients.consumer.internals.Fetcher.collectFetch(Fetcher.java:683)
	at org.apache.kafka.clients.consumer.KafkaConsumer.pollForFetches(KafkaConsumer.java:1314)
	at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1243)
	at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1216)
	at reactor.kafka.receiver.internals.ConsumerEventLoop$PollEvent.run(ConsumerEventLoop.java:357)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	at java.base@17.0.7/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base@17.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
Caused by: org.apache.kafka.common.KafkaException: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Linux and os.arch=x86_64
	at org.apache.kafka.common.compress.SnappyFactory.wrapForInput(SnappyFactory.java:46)
	at org.apache.kafka.common.record.CompressionType$3.wrapForInput(CompressionType.java:94)
	at org.apache.kafka.common.record.DefaultRecordBatch.recordInputStream(DefaultRecordBatch.java:276)
	at org.apache.kafka.common.record.DefaultRecordBatch.compressedIterator(DefaultRecordBatch.java:280)
	at org.apache.kafka.common.record.DefaultRecordBatch.streamingIterator(DefaultRecordBatch.java:364)
	at org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.nextFetchedRecord(Fetcher.java:1619)
	at org.apache.kafka.clients.consumer.internals.Fetcher$CompletedFetch.fetchRecords(Fetcher.java:1656)
	... 16 common frames omitted
Caused by: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Linux and os.arch=x86_64
	at org.xerial.snappy.SnappyLoader.findNativeLibrary(SnappyLoader.java:343)
	at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:177)
	at org.xerial.snappy.SnappyLoader.loadSnappyApi(SnappyLoader.java:155)
	at org.xerial.snappy.Snappy.init(Snappy.java:70)
	at org.xerial.snappy.Snappy.&lt;clinit&gt;(Snappy.java:47)
	at org.xerial.snappy.SnappyInputStream.readFully(SnappyInputStream.java:145)
	at org.xerial.snappy.SnappyInputStream.readHeader(SnappyInputStream.java:99)
	at org.xerial.snappy.SnappyInputStream.&lt;init&gt;(SnappyInputStream.java:59)
	at org.apache.kafka.common.compress.SnappyFactory.wrapForInput(SnappyFactory.java:44)
	... 22 common frames omitted

What I tried:

In my dependencies, I do have the most recent Snappy:

        &lt;dependency&gt;
            &lt;groupId&gt;org.xerial.snappy&lt;/groupId&gt;
            &lt;artifactId&gt;snappy-java&lt;/artifactId&gt;
            &lt;version&gt;1.1.9.1&lt;/version&gt;
        &lt;/dependency&gt;

On my machine, Ubuntu, I do have Snappy installed.

root@dlp:~# apt -y install snapd
root@dlp:~# systemctl  enable snapd.service snapd.socket
root@dlp:~# source /etc/profile.d/apps-bin-path.sh

Question:

How to fix this exception?

答案1

得分: 1

我已经安装了Snappy。

Snap / snapd 不同于 Snappy

您应该安装后者,使用 libsnappy-dev,因为这是错误所指的本地库。Java 依赖项需要这些。

如果您不需要 Snap 应用程序,则可以卸载 snapd。

英文:

> I do have Snappy installed.

Snap / snapd is not the same as Snappy .

You should install the latter with libsnappy-dev, as that is the native libraries that the error is referring to. The Java dependency requires those.

If you don't need Snap applications, then you can uninstall snapd

huangapple
  • 本文由 发表于 2023年5月11日 05:42:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76222734.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定