我该如何修复NoClassDefFoundError

时间:2019-07-23 10:53:45

标签: java apache-flink flink-cep

我正在编写CEP程序来检测用户何时更改工资,所以我编写了这段代码

    public class changePattern implements IWarningPattern<comptedata, changesalaire> {
    .
    .
    .
    public Pattern<comptedata, ?> getEventPattern() {
            return Pattern
                    .<comptedata>begin("First Event").subtype(comptedata.class).where(
                            new SimpleCondition<comptedata>() {
                                @Override
                                public boolean filter(comptedata event) throws Exception {
                                    if (event.getoperation()!="virement"){
                                        return false ;
                                    }
                                    return event.getMontantop() != event.getsalaire();
                                }
                            })
                    .followedBy("seconf Event").subtype(comptedata.class).where(
                            new SimpleCondition<comptedata>() {
                                @Override
                                public boolean filter(comptedata event) throws Exception {
                                    if (event.getoperation()!="virement"){
                                        return false ;
                                    }
                                    return event.getMontantop() != event.getsalaire();
                                }
                            });
}

但是它给了我这个错误

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/ExecutionConfig$ClosureCleanerLevel
    at org.apache.flink.cep.pattern.Pattern.where(Pattern.java:159)
    at myflink.cep.changePattern.getEventPattern(changePattern.java:19)
    at myflink.app.toWarningStream(app.java:63)
    at myflink.app.main(app.java:46)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.common.ExecutionConfig$ClosureCleanerLevel
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more

我添加了flink-java_2.11依赖项,但没有任何变化。 根据我的IDE changePattern.java:19是该函数的第二行,但我没弄错我的错

0 个答案:

没有答案