how to run flink project built with maven

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to run flink project built with maven

Jesse Lacika
I feel like this is probably the simplest thing, but I can't seem to figure it out, and I've searched and searched and can't find the answer, so I thought I'd try the mailing list. I'm using maven to build the sample flink project using the scala API as described here:


I've successfully built the project exactly as described. Now how do I run it?

Everything I've tried so far fails. For example:

$ ./bin/flink run --class WordCount ~/src/flink-gelly-test-maven/44/target/44-1.0-SNAPSHOT.jar

------------------------------------------------------------
 The program finished with the following exception:

org.apache.flink.client.program.ProgramInvocationException: The program's entry point class 'WordCount' was not found in the jar file.
        at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:613)
        at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:197)
        at org.apache.flink.client.CliFrontend.buildProgram(CliFrontend.java:866)
        at org.apache.flink.client.CliFrontend.run(CliFrontend.java:252)
        at org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:1054)
        at org.apache.flink.client.CliFrontend$1.call(CliFrontend.java:1101)
        at org.apache.flink.client.CliFrontend$1.call(CliFrontend.java:1098)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1807)
        at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
        at org.apache.flink.client.CliFrontend.main(CliFrontend.java:1098)
Caused by: java.lang.ClassNotFoundException: WordCount
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:610)
        ... 11 more

What am I doing wrong here?

Thanks,
Jesse
Reply | Threaded
Open this post in threaded view
|

Re: how to run flink project built with maven

Eron Wright
You must specify the full class name, in this case `org.example.WordCount`, for the `--class` argument.

On Fri, Jan 19, 2018 at 9:35 AM, Jesse Lacika <[hidden email]> wrote:
I feel like this is probably the simplest thing, but I can't seem to figure it out, and I've searched and searched and can't find the answer, so I thought I'd try the mailing list. I'm using maven to build the sample flink project using the scala API as described here:


I've successfully built the project exactly as described. Now how do I run it?

Everything I've tried so far fails. For example:

$ ./bin/flink run --class WordCount ~/src/flink-gelly-test-maven/44/target/44-1.0-SNAPSHOT.jar

------------------------------------------------------------
 The program finished with the following exception:

org.apache.flink.client.program.ProgramInvocationException: The program's entry point class 'WordCount' was not found in the jar file.
        at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:613)
        at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:197)
        at org.apache.flink.client.CliFrontend.buildProgram(CliFrontend.java:866)
        at org.apache.flink.client.CliFrontend.run(CliFrontend.java:252)
        at org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:1054)
        at org.apache.flink.client.CliFrontend$1.call(CliFrontend.java:1101)
        at org.apache.flink.client.CliFrontend$1.call(CliFrontend.java:1098)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1807)
        at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
        at org.apache.flink.client.CliFrontend.main(CliFrontend.java:1098)
Caused by: java.lang.ClassNotFoundException: WordCount
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:610)
        ... 11 more

What am I doing wrong here?

Thanks,
Jesse

Reply | Threaded
Open this post in threaded view
|

Re: how to run flink project built with maven

Jesse Lacika
Yep, that's it, so simple... Thanks!

On Fri, Jan 19, 2018 at 12:53 PM, Eron Wright <[hidden email]> wrote:
You must specify the full class name, in this case `org.example.WordCount`, for the `--class` argument.

On Fri, Jan 19, 2018 at 9:35 AM, Jesse Lacika <[hidden email]> wrote:
I feel like this is probably the simplest thing, but I can't seem to figure it out, and I've searched and searched and can't find the answer, so I thought I'd try the mailing list. I'm using maven to build the sample flink project using the scala API as described here:


I've successfully built the project exactly as described. Now how do I run it?

Everything I've tried so far fails. For example:

$ ./bin/flink run --class WordCount ~/src/flink-gelly-test-maven/44/target/44-1.0-SNAPSHOT.jar

------------------------------------------------------------
 The program finished with the following exception:

org.apache.flink.client.program.ProgramInvocationException: The program's entry point class 'WordCount' was not found in the jar file.
        at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:613)
        at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:197)
        at org.apache.flink.client.CliFrontend.buildProgram(CliFrontend.java:866)
        at org.apache.flink.client.CliFrontend.run(CliFrontend.java:252)
        at org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:1054)
        at org.apache.flink.client.CliFrontend$1.call(CliFrontend.java:1101)
        at org.apache.flink.client.CliFrontend$1.call(CliFrontend.java:1098)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1807)
        at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
        at org.apache.flink.client.CliFrontend.main(CliFrontend.java:1098)
Caused by: java.lang.ClassNotFoundException: WordCount
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:610)
        ... 11 more

What am I doing wrong here?

Thanks,
Jesse