Description:
Hey there,
first of all i would like to thank for developing this software! I am a backend engineer at [Prisma](https://github.com/prismagraphql/prisma). I am opening this issue as we are a happy user of this library and would like it to be compatible with Graal.
**What is Graal?**
Graal is a collection of tools. For one it is a JVM replacement that does not only run Java Bytecode but also other languages like Javascript or Ruby. It also comes with a tool called native image. This allows to **compile a JAR into a standalone binary**.
We would like to turn our Prisma Server into a lightweight binary with Graal.
However the Graal native image tool comes with some limitations. Some features of the JVM are not supported, e.g. the support for reflection is limited because it is not a good fit with ahead of time compilation. Therefore we created a [test suite](https://github.com/prismagraphql/graal-compatibility) to check the compatibility of our used dependencies with Graal. For each dependency we tried to come up with a super small program and see whether it compiles with Graal or not.
The program to test compatibility with this library can be found [here](https://github.com/prismagraphql/graal-compatibility/blob/master/mysql/src/main/scala/Main...).
**What's the problem we have hit?**
When running with `-H:+ReportUnsupportedElementsAtRuntime`:
```
Opening db connection
Exception in thread "main" java.lang.ClassCastException: com.mysql.cj.exceptions.CJException cannot be cast to com.mysql.cj.exceptions.WrongArgumentException
at com.mysql.cj.util.Util.getInstance(Util.java:187)
at com.mysql.cj.util.Util.getInstance(Util.java:192)
at com.mysql.cj.conf.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:201)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:204)
at Main$.main(Main.scala:25)
at Main.main(Main.scala)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:177)
```
When running without `-H:+ReportUnsupportedElementsAtRuntime`: This was stacktrace too long for this issue. So i attached my original notes as a file.
**Note**: The Graal compilation terminates on the first encountered error. Therefore there might be more problems that need to be addressed.
**How can incompatibilities with Graal be fixed?**
Here is a [blog post](https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-ed6...) by the Graal team that explains how the native image tool is working and how they were able to compile a server built on top of netty into a binary.
We ran this test with Graal `1.0.0-rc5`.
How to repeat:
The program to test compatibility with this library can be found [here](https://github.com/prismagraphql/graal-compatibility/blob/master/mysql/src/main/scala/Main...).
The repository also includes a script to run the Graal compilation.