Lucas Martins Soares
09/09/2023, 9:30 PMException in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/streaming/api/environment/StreamExecutionEnvironment
at spendreport.FraudDetectionJob.main(FraudDetectionJob.kt:34)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 1 more
Danny Cranmer
09/10/2023, 10:55 AMLucas Martins Soares
09/10/2023, 2:38 PMmvn archetype:generate \
-DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-walkthrough-datastream-java \
-DarchetypeVersion=1.17.1 \
-DgroupId=frauddetection \
-DartifactId=frauddetection \
-Dversion=0.1 \
-Dpackage=spendreport \
-DinteractiveMode=false
This is my pom.xml
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
Danny Cranmer
09/10/2023, 6:30 PM<scope>provided</provided>
when running in the IDE. Put it back for building Uber jars. Or setup maven profile for IDE that differs to your buildLucas Martins Soares
09/10/2023, 6:49 PMLucas Martins Soares
09/10/2023, 6:55 PMException in thread "main" java.lang.IllegalStateException: No ExecutorFactory found to execute the application.
at org.apache.flink.core.execution.DefaultExecutorServiceLoader.getExecutorFactory(DefaultExecutorServiceLoader.java:88)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getPipelineExecutor(StreamExecutionEnvironment.java:2717)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:2194)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:2084)
at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:68)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:2058)
at spendreport.FraudDetectionJob.main(FraudDetectionJob.kt:45)
Danny Cranmer
09/10/2023, 6:56 PMDanny Cranmer
09/10/2023, 6:56 PMWhy does this line work with the Java version but not with the Kotlin version?
It shouldn't work with the java version, so not sure
Lucas Martins Soares
09/10/2023, 7:07 PM<scope>provided</provided>
from flink-clients
works fine.Lucas Martins Soares
09/10/2023, 7:26 PMRunning the project in an IDE may result in a java.lang.NoClassDefFoundError exception. This is probably because you do not have all required Flink dependencies implicitly loaded into the classpath.
IntelliJ IDEA: Go to Run > Edit Configurations > Modify options > Select include dependencies with "Provided" scope. This run configuration will now include all required classes to run the application from within the IDE.
https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/try-flink/datastream/#running-in-an-ideDanny Cranmer
09/10/2023, 7:27 PMLucas Martins Soares
09/10/2023, 7:28 PMAleksandr Pilipenko
09/11/2023, 10:12 AMLucas Martins Soares
09/11/2023, 5:43 PMAleksandr Pilipenko
09/12/2023, 8:29 AMApplication
configuration and set main class as <package>.<filename>Kt
. Everything else is same as in Java.