无法在 Flink 仪表板版本 1.3.2 中执行 CEP 模式,这是由 ClassNotFoundException 引起的 [英] Unable to execute CEP pattern in Flink dashboard version 1.3.2 which is caused by ClassNotFoundException

查看:15
本文介绍了无法在 Flink 仪表板版本 1.3.2 中执行 CEP 模式,这是由 ClassNotFoundException 引起的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个这样的简单模式

I have written a simple pattern like this

   Pattern<JoinedEvent, ?> pattern = Pattern.<JoinedEvent>begin("start")
            .where(new SimpleCondition<JoinedEvent>() {
     @Override
     public boolean filter(JoinedEvent streamEvent) throws Exception {

            return streamEvent.getRRInterval()>= 10 ;
                        }
             }).within(Time.milliseconds(WindowLength));

并且它在 IntellijIdea 中运行良好.我在仪表板和 IntelliJ-Idea 中都使用 Flink 1.3.2.当我从源代码构建 Flink 时,我看到了很多警告消息,这让我相信迭代条件类尚未包含在 jar 中,因为错误还显示 ClassNotFoundException.下面是错误

and it executes well in IntellijIdea. I am using Flink 1.3.2 both in the dashboard and in IntelliJ-Idea. While I was building Flink from source, I have seen a lot of warning messages which led me to believe that iterative condition classes have not been included in a jar as error also says ClassNotFoundException. Below is the error

Caused by: java.lang.NoClassDefFoundError: org/apache/flink/cep/pattern/conditions/IterativeCondition
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at 

org.apache.flink.client.program.PackagedProgram.hasMainMethod(PackagedProgram.java:492)
    ... 38 more
Caused by: java.lang.ClassNotFoundException: org.apache.flink.cep.pattern.conditions.IterativeCondition
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 44 more

推荐答案

经过我一整天的努力,终于解决了这个问题.问题非常基本,即 Flink CEP 不是二进制发行版的一部分,所以每当我尝试执行模式时,它都会给我一个错误.

After a whole day of my effort to solve this problem, finally, I got the solution. The problem was pretty basic, which is that Flink CEP is not a part of the binary distribution, so whenever I tried to execute pattern it gave me an error.

解决方案很简单

如您所见,Flink Binary 没有 cep jar.

As you can see Flink Binary does not have the cep jar.

所以转到你的 IDE,在我的例子中是 IntelliJ 并复制所需的 jar

so go to your IDE which is IntelliJ in my case and copy the required jar

转到此位置并将此 jar 复制粘贴到二进制版本中的 lib 文件夹.

Go to this location and copy paste this jar to lib folder in your binary version.

Yalaa,问题解决了

Yalaa, problem solved

这篇关于无法在 Flink 仪表板版本 1.3.2 中执行 CEP 模式,这是由 ClassNotFoundException 引起的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆