akka/akka — pull request #875 by mpilquist (2012-11-16 02:36:07+00:00)
Title: Fix bug where ActorSystems created via OsgiActorSystemFactory(ctx).creat...

...eActorSystem fail to load akka.event classes unless bundle imports akka.event package.

Specifically, when using OsgiActorSystemFactory(ctx).createActorSystem(Some("name")) in a bundle who does not import akka.event, I get the following exception:

Caused by: akka.ConfigurationException: Could not start Event Handler due to [9962cf05-ca32-48e6-9643-417e51494acfakka.ConfigurationException: Event Handler specified in config can't be loaded [akka.event.Logging$DefaultLogger] due to [java.lang.ClassNotFoundException: akka.event.Logging$DefaultLogger from bundle 19 (my-bundle-name)]]
at akka.event.LoggingBus$class.startDefaultLoggers(Logging.scala:135) ~[na:na]
at akka.event.EventStream.startDefaultLoggers(EventStream.scala:26) ~[na:na]
at akka.actor.LocalActorRefProvider.init(ActorRefProvider.scala:549) ~[na:na]
at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:584) ~[na:na]
at akka.actor.ActorSystemImpl._start(ActorSystem.scala:582) ~[na:na]
at akka.actor.ActorSystemImpl.start(ActorSystem.scala:591) ~[na:na]
at akka.actor.ActorSystem$.apply(ActorSystem.scala:111) ~[na:na]
at akka.osgi.OsgiActorSystemFactory.createActorSystem(OsgiActorSystemFactory.scala:33) ~[na:na]

This is using Scala 2.10.0-RC2 with Akka 2.1.0-RC2 on Equinox 3.7.

The patch fixes this by backing the bundle classloader with the classloader of akka-actor. The patch is for the 2.1 branch but it cleanly applies to master as well.