Currently, the compiler for H2O models finds the current class loader as:
Thread.currentThread().getContextClassLoader
and checks if it is a URLClassLoader to search for the h2o-genmodel JAR file.
For Spark REPLs (spark-shell), this is not OK because the class loader is a scala.tools.nsc.interpreter.IMain$TranslatingClassLoader, which is not a URLClassLoader, but its parent is a scala.reflect.internal.util.ScalaClassLoader$URLClassLoader which is a URLClassLoader.
Therefore, it makes sense to search the class loader hierarchy in an to attempt to find the h2o-genmodel JAR. If not done, H2O models can't be compiled in environments such as spark-shell.
Currently, the compiler for H2O models finds the current class loader as:
and checks if it is a
URLClassLoader
to search for theh2o-genmodel
JAR file.For Spark REPLs (
spark-shell
), this is not OK because the class loader is ascala.tools.nsc.interpreter.IMain$TranslatingClassLoader
, which is not aURLClassLoader
, but its parent is ascala.reflect.internal.util.ScalaClassLoader$URLClassLoader
which is aURLClassLoader
.Therefore, it makes sense to search the class loader hierarchy in an to attempt to find the
h2o-genmodel
JAR. If not done, H2O models can't be compiled in environments such asspark-shell
.