The thread for cleaning abandoned connections is created in the JVM as static, so the GC can't do anything with it, which ultimately blocked unloading classes. In driver version 8.x, you can disable the creation of this thread by adding to the JVM parameter
-Dcom.mysql.cj.disableAbandonedConnectionCleanup=true
In Flink you can add this to config.yaml file like this:
env:
java:
opts:
all: -Dcom.mysql.cj.disableAbandonedConnectionCleanup=true
In older versions of the driver, there is no such option and the only thing you can do is to disable this thread manually at the application startup by executing com.mysql.jdbc.AbandonedConnectionCleanupThread.shutdown();