Saleh
05/08/2023, 12:35 PMNoClassDefFoundError
Here's what I did:
1. Run the Maven project archetype:generate command.
2. cd frauddetection
3. Run mvn clean package
4. Run java -jar target/frauddetection-0.1.jar
What I get:
Error: Unable to initialize main class spendreport.FraudDetectionJob
Caused by: java.lang.NoClassDefFoundError: org/apache/flink/streaming/api/functions/source/SourceFunction
Note that I did not touch any of the project files. I created a Slack account to post this after scouring the internet for two hours and no solution. Any help would be appreciated.David Anderson
05/08/2023, 4:50 PMSaleh
05/09/2023, 8:03 AMNoClassDefFoundError I think the problem is related to flink dependency scopes being set to "provided",
<!-- Apache Flink dependencies -->
<!-- These dependencies are provided, because they should not be packaged into the JAR file. -->
Why shouldn't they be package into the JAR? I could not find an explanation anywhere. I assume that they would be necessary for the program to run.
Am I building it wrong? I'm just doing mvn package ; java -jar myjar . I could get the program to run when I set the dependency scopes to "compile" but I had to remove the exclusions for log4j dependencies in the shade config.
How am I supposed to build a flink program? I can't fathom that the way to build one is change the maven config in an undocumented way for even the "quickstart" skeleton.David Anderson
05/09/2023, 7:19 PM