[英]How do you add dependencies to google dataflow?
I am trying to add opencv to a data-flow project. 我正在尝试将opencv添加到数据流项目中。 And from what I have read, all you should have to do is add the opencv jar and it will be uploaded to the staging bucket. 从我读到的内容来看,您需要做的就是添加opencv jar并将其上传到登台存储桶。 But I know that cant be all (mostly doesn't work). 但是我知道这不可能全部(大多数情况下是行不通的)。 I get the following error when I try to run my code as a direct pipeline on my local machine. 当我尝试在本地计算机上将代码作为直接管道运行时,出现以下错误。
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.videoio.VideoCapture.VideoCapture_1(Ljava/lang/String;)J at org.opencv.videoio.VideoCapture.VideoCapture_1(Native Method) at org.opencv.videoio.VideoCapture.<init>(VideoCapture.java:40)
I have read this post, How do I add Java dependencies to a Google Dataflow project? 我已经阅读了这篇文章, 如何将Java依赖项添加到Google Dataflow项目中? , but all it says it to add the jar to the classpath. ,但上面说的都是将jar添加到类路径中。 Which doesnt work. 这不起作用。 I am missing something obvious I feel. 我缺少明显的感觉。
UnsatisfiedLinkError is: Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native. UnsatisfiedLinkError是:如果Java虚拟机无法找到声明为native的方法的适当本机语言定义,则抛出该异常。 https://docs.oracle.com/javase/7/docs/api/java/lang/UnsatisfiedLinkError.html https://docs.oracle.com/javase/7/docs/api/java/lang/UnsatisfiedLinkError.html
Since the issue is occurring when you build/run locally, it is not related to the Dataflow Service or uploading to a staging bucket. 由于此问题是在本地构建/运行时发生的,因此与Dataflow Service无关或与上载到暂存存储桶无关。
A quick Google search for "opencv UnsatisfiedLinkError" brought up many results. Google快速搜索“ opencv UnsatisfiedLinkError”带来了许多结果。 The most common response was that this line is missing: 最常见的答复是缺少此行:
static {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.