2

My Flink Program runs successfully in IntellijIdea, but when I make a jar file of that program to submit it as jar, it shows me the following error

ava.lang.RuntimeException: Could not look up the main(String[]) method from the class org.carleton.cep.monitoring.latest.MobileCEP: org/apache/flink/cep/pattern/conditions/IterativeCondition
    at org.apache.flink.client.program.PackagedProgram.hasMainMethod(PackagedProgram.java:480)
    at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:217)
    at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:148)
    at org.apache.flink.runtime.webmonitor.handlers.JarActionHandler.getJobGraphAndClassLoader(JarActionHandler.java:91)
    at org.apache.flink.runtime.webmonitor.handlers.JarPlanHandler.handleRequest(JarPlanHandler.java:42)
    at org.apache.flink.runtime.webmonitor.RuntimeMonitorHandler.respondAsLeader(RuntimeMonitorHandler.java:88)
    at org.apache.flink.runtime.webmonitor.RuntimeMonitorHandlerBase.channelRead0(RuntimeMonitorHandlerBase.java:84)
    at org.apache.flink.runtime.webmonitor.RuntimeMonitorHandlerBase.channelRead0(RuntimeMonitorHandlerBase.java:44)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at io.netty.handler.codec.http.router.Handler.routed(Handler.java:62)
    at io.netty.handler.codec.http.router.DualAbstractHandler.channelRead0(DualAbstractHandler.java:57)
    at io.netty.handler.codec.http.router.DualAbstractHandler.channelRead0(DualAbstractHandler.java:20)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at org.apache.flink.runtime.webmonitor.HttpRequestHandler.channelRead0(HttpRequestHandler.java:105)
    at org.apache.flink.runtime.webmonitor.HttpRequestHandler.channelRead0(HttpRequestHandler.java:65)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:147)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    at java.lang.Thread.run(Thread.java:748)
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:474)
    ... 34 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)
    ... 40 more

I have taken care of classpath in the manifest file, Previously I was able to run with my jar as well.

It seems that there is some issue with my pattern code which is given below

 // detecting pattern

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

                            return streamEvent.getRRInterval()>= 10 ;
                        }
                    })

            .subtype(JoinedEvent.class).where(new SimpleCondition<JoinedEvent>() {
                @Override
                public boolean filter(JoinedEvent streamEvent) throws Exception {
                    return streamEvent.getQrsInterval() >= 10 ;
                }
            } )
            .within(Time.milliseconds(WindowLength));
Amarjit Dhillon
  • 2,718
  • 3
  • 23
  • 62

1 Answers1

1

Check that the scope of the dependency is set to compile and not provided. You can either set it in the pom.xml or go to "File>Project Structure>Modules" and see on the right side a dependencies tab. In that tab you will see the dependencies of the project. Find the dependency for flink.cep (not sure if that is in the core flink library or an additional dependency) and make the scope set to compile if it isn't already. Then, as pointed out by @MikCode in his comment, run mvn clean install to make sure everything is set and try again.

Jicaar
  • 1,044
  • 10
  • 26