Hi Le,
Indeed you have added the dependency correctly. But the resulting artifact
doesn't contain the dependencies. You need to create a jar with
dependencies ( via [1] or [2])
Take a look at [3] for a usage example of the maven shade plugin.

I hope this helps,
Igal.

[1] https://maven.apache.org/plugins/maven-assembly-plugin/usage.html
[2] https://maven.apache.org/plugins/maven-shade-plugin/
[3]
https://github.com/apache/flink-statefun/blob/master/statefun-flink/statefun-flink-distribution/pom.xml#L126,L199

On Sat, Dec 26, 2020 at 11:52 PM Le Xu <sharonx...@gmail.com> wrote:

> Thanks Igal! I might be missing something here. I did place
> statefun-flink-distribution as part of my dependency in the pom (see line
> 46 at [1]).  Is there a correct way to include the jar? I'm having the same
> problem across many examples I'm running.
>
> [1]
> https://gist.github.com/flint-stone/059f00832d8b99af433a446771f4f740#file-pom-xml-L64
>
> Thanks!
>
> Le
>
> On Sat, Dec 26, 2020 at 2:23 PM Igal Shilman <i...@ververica.com> wrote:
>
>> Hello :-)
>>
>> It seems like in your attached pom you are not bundling the dependencies.
>> Check out the docs here [1].
>>
>>
>> [1]
>> https://ci.apache.org/projects/flink/flink-statefun-docs-release-2.2/deployment-and-operations/packaging.html#flink-jar
>>
>>
>> On Wed, Dec 23, 2020 at 3:07 AM Le Xu <sharonx...@gmail.com> wrote:
>>
>>> Hello!
>>> I'm trying to deploy a Flink stateful function as a flink jar and I
>>> followed the instruction here <https://github.com/apache/flink-statefun>.
>>> However I'm getting the error saying that the program entry point class was
>>> not found in the jar even after I added the dependency in my pom.
>>>
>>> Running:
>>>
>>> bin/flink run -c org.apache.flink.statefun.flink.core.StatefulFunctionsJob 
>>> flink-statefun/statefun-examples/statefun-greeter-example/target/statefun-greeter-example-2.3-SNAPSHOT.jar
>>>
>>> Producing the following error:
>>>
>>> org.apache.flink.client.program.ProgramInvocationException: The program's 
>>> entry point class 
>>> 'org.apache.flink.statefun.flink.core.StatefulFunctionsJob' was not found 
>>> in the jar file.
>>>     at 
>>> org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:389)
>>>     at 
>>> org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:139)
>>>     at 
>>> org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:61)
>>>     at 
>>> org.apache.flink.client.program.PackagedProgram$Builder.build(PackagedProgram.java:557)
>>>     at 
>>> org.apache.flink.client.cli.CliFrontend.buildProgram(CliFrontend.java:726)
>>>     at 
>>> org.apache.flink.client.cli.CliFrontend.getPackagedProgram(CliFrontend.java:242)
>>>     at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:223)
>>>     at 
>>> org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:916)
>>>     at 
>>> org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:992)
>>>     at 
>>> org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
>>>     at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:992)
>>> Caused by: java.lang.ClassNotFoundException: 
>>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob
>>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
>>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
>>>     at 
>>> org.apache.flink.util.FlinkUserCodeClassLoader.loadClassWithoutExceptionHandling(FlinkUserCodeClassLoader.java:61)
>>>     at 
>>> org.apache.flink.util.ChildFirstClassLoader.loadClassWithoutExceptionHandling(ChildFirstClassLoader.java:65)
>>>     at 
>>> org.apache.flink.util.FlinkUserCodeClassLoader.loadClass(FlinkUserCodeClassLoader.java:48)
>>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
>>>     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:387)
>>>     ... 10 more
>>> Here is my modified pom.xml 
>>> <https://gist.github.com/flint-stone/059f00832d8b99af433a446771f4f740>. The 
>>> original version of the pom file can be found here here 
>>> <https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/pom.xml>.
>>>  It seems that adding the extra dependency of statefun-flink-distribution 
>>> has no effect. Any suggestions?
>>>
>>> Thanks!
>>>
>>> Le
>>>
>>>
>>>
>>>

Reply via email to