Skip to content
Advertisement

Apache Flink – External Jar

i’m trying to create a Flink application using maven and an extra dependency :

Im trying to fetch extra information from our database. When I run the code locally, everything is fine, but when run on Flink, I get this error message : enter image description here

So my initial tought was the dependency was not loaded on the fat jar using the maven shadow pluging, but I think it is. enter image description here

My Flink is run in a docker container, Ive open port 1433:1433 on the container (in the compose).

My goal is to add SQL data to the stream for an alerting system with custom rules by user.

Here is the content of my pom.xml :

–> http://maven.apache.org/xsd/maven-4.0.0.xsd”> 4.0.0

Thank you for your help !

Advertisement

Answer

Adding Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver") in your main method will work for you I think because shading seems correct.

The other problem is that you are using java 1.8 to compile in your pom but you are adding a dependency compiled with java 11. Changing the jdbc version to the following will hopefully work.

Please read this for more details

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement