1
votes

I have the following test case:

class MutableStateActorTest extends TestKit(ActorSystem("MutableStateActorTest")) with WordSpecLike with Matchers {

  "A MutableStateActor" must {

    val actRef = TestActorRef[MutableStateActor]

    "mutate state in order" in {
      1 to 5 foreach {
        x => actRef ! Increment
      }
    }
  }
}

It can't be simpler that that, but I get the following error when I tried to run it:

An exception or error caused a run to abort: Found class akka.actor.ActorPath, but interface was expected 
java.lang.IncompatibleClassChangeError: Found class akka.actor.ActorPath, but interface was expected
    at akka.testkit.TestActorRef.<init>(TestActorRef.scala:47)
    at akka.testkit.TestActorRef$.apply(TestActorRef.scala:141)
    at akka.testkit.TestActorRef$.apply(TestActorRef.scala:137)
    at akka.testkit.TestActorRef$.apply(TestActorRef.scala:146)
    at akka.testkit.TestActorRef$.apply(TestActorRef.scala:144)
    at q31.sandbox.statetest.MutableStateActorTest$$anonfun$1.apply$mcV$sp(MutableStateActorTest.scala:16)
    at q31.sandbox.statetest.MutableStateActorTest$$anonfun$1.apply(MutableStateActorTest.scala:14)
    at q31.sandbox.statetest.MutableStateActorTest$$anonfun$1.apply(MutableStateActorTest.scala:14)

I guess it has got something to do with Actor References?

1
What version of akka are you running and do you possibly have multiple versions of akka on your classpath?cmbaxter

1 Answers

3
votes

You're probably running against a snapshot version of akka. In the latest versions of akka 2.4 some things have changed with regards to the ActorRef, or better said the ActorPath. A library you're using is compiled against an older version of akka so is expecting ActorPath to be an interface, instead of a class which it is in the newer versions.

The conflicting change seems to be this one: https://github.com/akka/akka/commit/e6aea0b7d1bab7668072e1d92945ebb1865bdd9a

In this change (amongs other things the following was changed: -sealed trait ActorPath extends Comparable[ActorPath] with Serializable { +sealed abstract class ActorPath extends Comparable[ActorPath] with Serializable {

To fix this, either move away from the snapshots you're probably using in your own project, or recompile the code from the project that throws the error, against the akka (snapshot) version you're using yourself.