Class cast exception when running with Java 9
morazow opened this issue · 1 comments
morazow commented
When running hadoop-etl-udfs in Java 9 runtime, e.g, Exasol 6.2.x, an ClassCastException
exception is thrown.
Problem
Exception:
Exception in thread "main" java.lang.ClassCastException:
class jdk.internal.loader.ClassLoaders$AppClassLoader
cannot be cast to class java.net.URLClassLoader
(jdk.internal.loader.ClassLoaders$AppClassLoader
and
java.net.URLClassLoader are in module java.base of loader 'bootstrap')
This is due to fact that in Java 9 the application class loader is not an instance URLClassLoader
. For more information, please read JEP261#Class_loaders.
Solution
There are possible solutions.
- Compile using Java 9. In my opinion, this is two early since both Hadoop and Hive dependencies are still using Java 8.
- Depending on Java version, load urls differently.