You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Stefan Richter <s....@data-artisans.com> on 2016/10/17 08:50:38 UTC

Re: First Program with WordCount - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/functions/FlatMapFunction

Hi,

looks like there is no Flink jar in the classpath with which you run your program. You need to make sure that they relevant jars are there or else your program cannot find Flink’s classes, leading to a ClassNotFoundException.

Best,
Stefan

> Am 16.10.2016 um 19:26 schrieb Kaepke, Marc <ma...@haw-hamburg.de>:
> 
> Hi guys,
> 
> I followed this guide (https://ci.apache.org/projects/flink/flink-docs-release-1.2/quickstart/java_api_quickstart.html <https://ci.apache.org/projects/flink/flink-docs-release-1.2/quickstart/java_api_quickstart.html>), but I get an Exception if I run WordCount 
> 
> /usr/lib/jvm/java-8-oracle/bin/java -Didea.launcher.port=7536 -Didea.launcher.bin.path=/home/marc/Programs/idea-IC-162.2032.8/bin -Dfile.encoding=UTF-8 -classpath "/usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/home/marc/apache flink/flink.gelly/target/classes:/home/marc/Programs/idea-IC-162.2032.8/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain haw.bachelor.flink.gelly.WordCount
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/functions/FlatMapFunction
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:264)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
> Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.common.functions.FlatMapFunction
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 3 more
> 
> 
> my environment:
> Ubuntu 14.04 LTS
> Oracle Java 8
> Maven 3.0.5
> intellij communityedition
> 
> 
> thanks for help
> Marc


Re: First Program with WordCount - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/functions/FlatMapFunction

Posted by Maximilian Michels <mx...@apache.org>.
This usually happens when you enable the 'build-jar' profile from
within IntelliJ. This profile assumes you have a Flink installation in
the class path which is only true if you submit the job to an existing
Flink cluster.

-Max


On Mon, Oct 17, 2016 at 10:50 AM, Stefan Richter
<s....@data-artisans.com> wrote:
> Hi,
>
> looks like there is no Flink jar in the classpath with which you run your
> program. You need to make sure that they relevant jars are there or else
> your program cannot find Flink’s classes, leading to a
> ClassNotFoundException.
>
> Best,
> Stefan
>
> Am 16.10.2016 um 19:26 schrieb Kaepke, Marc <ma...@haw-hamburg.de>:
>
> Hi guys,
>
> I followed this guide
> (https://ci.apache.org/projects/flink/flink-docs-release-1.2/quickstart/java_api_quickstart.html),
> but I get an Exception if I run WordCount
>
> /usr/lib/jvm/java-8-oracle/bin/java -Didea.launcher.port=7536
> -Didea.launcher.bin.path=/home/marc/Programs/idea-IC-162.2032.8/bin
> -Dfile.encoding=UTF-8 -classpath
> "/usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/home/marc/apache
> flink/flink.gelly/target/classes:/home/marc/Programs/idea-IC-162.2032.8/lib/idea_rt.jar"
> com.intellij.rt.execution.application.AppMain
> haw.bachelor.flink.gelly.WordCount
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/flink/api/common/functions/FlatMapFunction
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:264)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.flink.api.common.functions.FlatMapFunction
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 3 more
>
>
> my environment:
>
> Ubuntu 14.04 LTS
> Oracle Java 8
> Maven 3.0.5
> intellij communityedition
>
>
>
> thanks for help
> Marc
>
>