AWS Kinesis Video Streams - Producer SDK Java - JNI 异常

问题描述 投票:0回答:1

我想从网络摄像头流式传输到 Kinesis Video Streams。 我一直在阅读文档并遵循AWS教程。 使用以下命令启动 DemoAppMain 后:

java -classpath目标/amazon-kinesis-video-streams- Producer-sdk-java-1.11.0-jar-with-dependency.jar“-Daws.accessKeyId = fake_accessKeyID -Daws.secretKey = fake_secretKey -Dkvs-stream = fake_streamName -Djava.library.path=src\main esources\lib\windows\KinesisVideoProducerJNI.dll" com.amazonaws.kinesisvideo.demoapp.DemoAppMain

我遇到以下例外情况:

DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library .so.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library .dylib.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library .dll.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library libKinesisVideoProducerJNI.so.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library libKinesisVideoProducerJNI.dylib.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library libKinesisVideoProducerJNI.dll.
ERROR / KinesisVideo: 2021-10-18T10:50Z T1: EXCEPTION: UnsatisfiedLinkError: Unsatisfied link error. Loading native library KinesisVideoProducerJNI failed with java.lang.UnsatisfiedLinkError: no KinesisVideoProducerJNI in java.library.path: ...
Exception in thread "main" java.lang.RuntimeException: com.amazonaws.kinesisvideo.producer.ProducerException: Failed loading native library StatusCode: 0xd
    at com.amazonaws.kinesisvideo.demoapp.DemoAppMain.main(DemoAppMain.java:60)
Caused by: com.amazonaws.kinesisvideo.producer.ProducerException: Failed loading native library StatusCode: 0xd
    at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.initializeLibrary(NativeKinesisVideoProducerJni.java:1177)
    at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.create(NativeKinesisVideoProducerJni.java:229)
    at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.createSync(NativeKinesisVideoProducerJni.java:247)
    at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.createSync(NativeKinesisVideoProducerJni.java:212)
    at com.amazonaws.kinesisvideo.internal.client.NativeKinesisVideoClient.initializeNewKinesisVideoProducer(NativeKinesisVideoClient.java:238)
    at com.amazonaws.kinesisvideo.internal.client.NativeKinesisVideoClient.initialize(NativeKinesisVideoClient.java:119)
    at com.amazonaws.kinesisvideo.java.client.KinesisVideoJavaClientFactory.createKinesisVideoClient(KinesisVideoJavaClientFactory.java:113)
    at com.amazonaws.kinesisvideo.java.client.KinesisVideoJavaClientFactory.createKinesisVideoClient(KinesisVideoJavaClientFactory.java:86)
    at com.amazonaws.kinesisvideo.demoapp.DemoAppMain.main(DemoAppMain.java:42)

我在互联网上进行了研究,但没有成功。这就是我发这篇文章的原因。 如果有人知道如何解决这个问题,我将非常感激!

java amazon-web-services stream amazon-kinesis-video-streams
1个回答
1
投票

错误指出:

no KinesisVideoProducerJNI in java.library.path

你是如何将此库准确添加到你的类路径中的?

文档说明了拥有此库的先决条件:

Your NativeLibraryPath must contain your KinesisVideoProducerJNI file, available at https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp

. The file name extension for this file depends on your operating system:

    KinesisVideoProducerJNI.so for Linux

    KinesisVideoProducerJNI.dylib for macOS

    KinesisVideoProducerJNI.dll for Windows

如果您查看 Windows 文件夹,该库就存在于其中:

https://github.com/awslabs/amazon-kinesis-video-streams- Producer-sdk-java/tree/master/src/main/resources/lib/windows

也许这样做会起作用:

-Djava.library.path=src/main/resources/lib/windows  <-- The Directory!

java -classpath 目标/amazon-kinesis-video-streams- Producer-sdk-java-1.11.0-jar-with-dependency.jar -Daws.accessKeyId= -Daws.secretKey= -Dkvs-stream= -Djava.library.path=src/main/resources/lib/windows com.amazonaws.kinesisvideo.demoapp.DemoAppMain

© www.soinside.com 2019 - 2024. All rights reserved.