[2.4.6] ClassLoader problem when running tests in SBT

514 views
Skip to first unread message

Edmondo Porcu

unread,
May 29, 2016, 6:53:59 AM5/29/16
to Akka User List
Hello,

when I try to run my tests from SBT the first time they correctly compile and execute.

On the second run, I get the following error:

java.lang.ClassCastException: interface akka.event.LoggingFilter is not assignable from class akka.event.DefaultLoggingFilter (ReflectiveDynamicAccess.scala:23)
[error] akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(ReflectiveDynamicAccess.scala:23)
[error] akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(ReflectiveDynamicAccess.scala:20)
[error] akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:20)
[error] akka.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:38)


In my Specs2 tests I am creating and tearing down an ActorSystem (I will eventually move to a single shared actor systems across multiple tests, but it should not make any difference). How can I address this issue? Restarting SBT solves it, but obviously it is not a sustainable solution

Thanks

Edmondo

Viktor Klang

unread,
May 29, 2016, 7:20:58 AM5/29/16
to Akka User List
Edmondo,

when you create your ActorSystem you'll have to provide it with a stable ClassLoader.
Ask on the sbt-ML which ClassLoader is preferrable.

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

Edmondo Porcu

unread,
May 29, 2016, 11:06:14 AM5/29/16
to Akka User List
Thanks a lot, how do you test inside akka project itself?

Viktor Klang

unread,
May 29, 2016, 11:37:28 AM5/29/16
to Akka User List

We don't use specs2 afaik

--
Cheers,

Akka Team

unread,
May 30, 2016, 8:46:33 AM5/30/16
to Akka User List
We use Scalatest, but Specs2 should work fine as well. There is most likely something special in your project setup or tests. 

For example it could be that you run the tests non-forked and keep a reference to the DefaultLoggingFilter in an object that lives across test runs.

--
Johan
Reply all
Reply to author
Forward
0 new messages