Hi everyone,

I may have found a fix for the classloader issues I'm having when
running unit tests
(https://groups.google.com/forum/#!topic/akka-user/U0mLX3mCmAk).
Basically the issue appears to happen when a test suite that uses the
Akka TestKit base class does not define an explicit classloader.

I.e. the following will result in a cryptic error:

class ExecuteRequestHandlerSpec extends TestKit(
  ActorSystem("ExecuteRequestHandlerSpec")) { //tests }

whereas explicitly defining a classloader for the actor system works fine:

class ExecuteRequestHandlerSpec extends TestKit(
  ActorSystem("ExecuteRequestHandlerSpec",
    org.apache.toree.Main.getClass.getClassLoader)) { //tests }

I have seen that latter approach used in various tests, however the
classloaders are not specified consistently in all tests. My proposed
approach to fixing the tests is to make classloaders explicit
everywhere (thinking about creating a utility mixin, instead of using
TestKit directly).

I'm not very well versed in all the class loader magic that happens
within Spark, Akka and sbt, and would greatly appreciate any input as
to why the exceptions are raised in the first place and whether my
proposal is actually a clean fix or just some quick hack.

cheers,
--Jakob

Reply via email to