java.lang.ClassNotFoundException:使用带有sbt版本1.0.2的akka​​ 2.5.6时的scala.Int

时间:2017-10-27 20:11:26

标签: sbt typesafe-config

我正在尝试使用akka -remoting版本2.5.4和最新的sbt 1.0.2

当我使用sbt版本0.13.15或0.13.16时,它运行良好。

但是当我使用sbt verion 1.0.2作为here时,我的误差低于此值。

以下异常是运行时异常。

[error] (run-main-0) java.lang.ClassNotFoundException: scala.Int
[error] java.lang.ClassNotFoundException: scala.Int
[error]     at sbt.internal.inc.classpath.ClasspathFilter.loadClass(ClassLoaders.scala:74)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     at java.lang.Class.forName0(Native Method)
[error]     at java.lang.Class.forName(Class.java:348)
[error]     at akka.actor.ReflectiveDynamicAccess.$anonfun$getClassFor$1(ReflectiveDynamicAccess.scala:21)
[error]     at scala.util.Try$.apply(Try.scala:209)
[error]     at akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:20)
[error]     at akka.serialization.Serialization.$anonfun$bindings$3(Serialization.scala:313)
[error]     at scala.collection.TraversableLike$WithFilter.$anonfun$map$2(TraversableLike.scala:739)
[error]     at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:231)
[error]     at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:462)
[error]     at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:738)
[error]     at akka.serialization.Serialization.<init>(Serialization.scala:311)
[error]     at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:15)
[error]     at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:12)
[error]     at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:880)
[error]     at akka.actor.ExtensionId.apply(Extension.scala:77)
[error]     at akka.actor.ExtensionId.apply$(Extension.scala:77)
[error]     at akka.serialization.SerializationExtension$.apply(SerializationExtension.scala:12)
[error]     at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:203)
[error]     at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:796)
[error]     at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:793)
[error]     at akka.actor.ActorSystemImpl._start(ActorSystem.scala:793)
[error]     at akka.actor.ActorSystemImpl.start(ActorSystem.scala:809)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:244)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:287)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:262)
[error]     at module09.remoteB.RemoteBStartup$.main(RemoteBStartup.scala:8)
[error]     at module09.remoteB.RemoteBStartup.main(RemoteBStartup.scala)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:498)
[error]     at sbt.Run.invokeMain(Run.scala:89)
[error]     at sbt.Run.run0(Run.scala:83)
[error]     at sbt.Run.execute$1(Run.scala:61)
[error]     at sbt.Run.$anonfun$run$4(Run.scala:73)
[error]     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]     at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error]     at sbt.TrapExit$App.run(TrapExit.scala:252)
[error]     at java.lang.Thread.run(Thread.java:748)

github位置为here

对我来说,这看起来错误是因为ConfigFactory.load itertools.chain()因为sbt最新版本而遇到了一些问题。

2 个答案:

答案 0 :(得分:3)

这是sbt中的一个错误,所以我filed it as such并且它已在sbt 1.1.0版中修复。

(如果结果难以解决,我们可能会考虑implement a workaround in Akka,但事实证明这不是必需的)

答案 1 :(得分:2)

添加fork in run := true(将分叉JVM以运行任务)似乎可以解决sbt的问题。

此解决方法被指出为对the issue opened by @Arnout

的回复