我有akka项目。
这是src / resources文件夹中的application-1.conf。
akka {
loglevel="INFO"
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 2552
}
log-sent-messages=on
log-received-messages=on
}
}
以下是我在文件夹src / main / scala / example7_2的软件包example7_2中的操作。
package example7_2
import akka.actor.Actor
class SimpleActor extends Actor {
override def receive: Receive = {
case msg => println(s"I have been created at
${self.path.address.hostPort} and received message $msg")
}
}
我有以下主要应用HelloAkkaRemoting10
。
package example7_2
import akka.actor.ActorSystem
import com.typesafe.config.ConfigFactory
object HelloAkkaRemoting10 extends App {
val actorSystem = ActorSystem("HelloAkkaRemoting1", ConfigFactory.load("application-1"))
}
当我运行应用程序时,我得到了
[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 example7_2.HelloAkkaRemoting10$.delayedEndpoint$example7_2$HelloAkkaRemoting10$1(HelloAkkaRemoting10.scala:7)
[error] at example7_2.HelloAkkaRemoting10$delayedInit$body.apply(HelloAkkaRemoting10.scala:6)
[error] at scala.Function0.apply$mcV$sp(Function0.scala:34)
[error] at scala.Function0.apply$mcV$sp$(Function0.scala:34)
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error] at scala.App.$anonfun$main$1$adapted(App.scala:76)
[error] at scala.collection.immutable.List.foreach(List.scala:389)
[error] at scala.App.main(App.scala:76)
[error] at scala.App.main$(App.scala:74)
[error] at example7_2.HelloAkkaRemoting10$.main(HelloAkkaRemoting10.scala:6)
[error] at example7_2.HelloAkkaRemoting10.main(HelloAkkaRemoting10.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)
[error] java.lang.RuntimeException: Nonzero exit code: 1
[error] at sbt.Run$.executeTrapExit(Run.scala:120)
[error] at sbt.Run.run(Run.scala:73)
[error] at sbt.Defaults$.$anonfun$bgRunMainTask$6(Defaults.scala:1130)
[error] at sbt.Defaults$.$anonfun$bgRunMainTask$6$adapted(Defaults.scala:1125)
[error] at sbt.internal.BackgroundThreadPool.$anonfun$run$1(DefaultBackgroundJobService.scala:359)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at scala.util.Try$.apply(Try.scala:209)
[error] at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:282)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (chapter7/compile:runMain) Nonzero exit code: 1
[error] Total time: 3 s, completed Oct 18, 2017 11:11:52 AM
其他杂项详情 -
sbt version - 1.0.2 scala版本 - 2.12.3 akka版本 - 2.5.4
向我看来ConfigFactory加载错误但不确定确切的根本原因。如果我遗漏任何配置,请告诉我。
答案 0 :(得分:3)
这似乎是sbt中的一个与Typesafe配置无关的错误,只是与Akka略有关系,我已将其归档为https://github.com/sbt/sbt/issues/3736