[2.4.6] ClassLoader problem when running tests in SBT

瀏覽次數:514 次
跳到第一則未讀訊息

Edmondo Porcu

未讀,
2016年5月29日 清晨6:53:592016/5/29
收件者: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

未讀,
2016年5月29日 清晨7:20:582016/5/29
收件者: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

未讀,
2016年5月29日 上午11:06:142016/5/29
收件者:Akka User List
Thanks a lot, how do you test inside akka project itself?

Viktor Klang

未讀,
2016年5月29日 上午11:37:282016/5/29
收件者:Akka User List

We don't use specs2 afaik

--
Cheers,

Akka Team

未讀,
2016年5月30日 上午8:46:332016/5/30
收件者: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
回覆所有人
回覆作者
轉寄
0 則新訊息