嗨,我正在关注这个教程,我照原样复制粘贴了代码,除了我将端口从 5150 更改为 2552 并且我遇到了这些错误 HelloLocal 项目错误
[warn] there were 1 deprecation warning(s); re-run with -deprecation for details
[warn] one warning found
[info] Running HelloLocal
[INFO] [11/04/2014 22:37:50.707] [run-main-0] [Remoting] Starting remoting
[INFO] [11/04/2014 22:37:51.857] [run-main-0] [Remoting] Remoting started; listening on addresses :[akka.tcp://LocalSystem@127.0.1.1:2552]
[INFO] [11/04/2014 22:37:51.863] [run-main-0] [Remoting] Remoting now listens on addresses: [akka.tcp://LocalSystem@127.0.1.1:2552]
[ERROR] [11/04/2014 22:37:51.904] [LocalSystem-akka.actor.default-dispatcher-3] [RemoteActorRefProvider] Error while looking up address [akka://HelloRemoteSystem@127.0.0.1:2552]
akka.remote.RemoteTransportException: No transport is loaded for protocol: [akka], available protocols: [akka.tcp]
at akka.remote.Remoting$.localAddressForRemote(Remoting.scala:88)
at akka.remote.Remoting.localAddressForRemote(Remoting.scala:130)
at akka.remote.RemoteActorRefProvider.actorFor(RemoteActorRefProvider.scala:321)
at akka.actor.ActorRefFactory$class.actorFor(ActorRefProvider.scala:258)
at akka.actor.ActorCell.actorFor(ActorCell.scala:369)
at LocalActor.<init>(HelloLocal.scala:7)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at akka.util.Reflect$.instantiate(Reflect.scala:45)
at akka.actor.NoArgsReflectConstructor.produce(Props.scala:361)
at akka.actor.Props.newActor(Props.scala:252)
at akka.actor.ActorCell.newActor(ActorCell.scala:552)
at akka.actor.ActorCell.create(ActorCell.scala:578)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
at akka.dispatch.Mailbox.run(Mailbox.scala:219)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[INFO] [11/04/2014 22:37:51.913] [LocalSystem-akka.actor.default-dispatcher-5] [akka://HelloRemoteSystem@127.0.0.1:2552/user/RemoteActor] Message [java.lang.String] from Actor[akka://LocalSystem/user/LocalActor#543076206] to Actor[akka://HelloRemoteSystem@127.0.0.1:2552/user/RemoteActor] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
HelloRemote 项目错误是:
[info] Running HelloRemote
Remote Actor receive messgage : The remote actor is alive
[INFO] [11/04/2014 22:38:40.915] [HelloRemoteSystem-akka.actor.default-dispatcher-2] [akka://HelloRemoteSystem/deadLetters] Message [java.lang.String] from Actor[akka://HelloRemoteSystem/user/RemoteActor#-1308265074] to Actor[akka://HelloRemoteSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
我是akka的新手,出于学习目的,我正在关注本教程,现在有错误请帮助我解决它们
在遵循 akka-remitng 2.3.6 之后进行编辑现在我遇到了不同的错误 aplication.conf (helloLocal)
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transport = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 0
}
}
}
HelloLoca.scala 导入 akka.actor._
class LocalActor extends Actor {
//create the remote actor
val remote = context.actorSelection("akka.tcp://HelloRemoteSystem@127.0.0.1:2552/user/RemoteActor")
var counter = 0
def receive = {
case "START" =>
remote ! "Hello from the LocalActor"
case msg: String =>
println(s"LocalActor received message: '$msg'")
if (counter < 5) {
sender ! "Hello back to you"
counter += 1
}
}
}
object HelloLocal extends App{
implicit val system =ActorSystem("LocalSystem")
val localActor =system.actorOf(Props[LocalActor],name="LocalActor")
localActor ! "START"
}
和 HelloRemote application.conf 是
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transport = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 2552
}
}
}
这些是现在的错误 HelloLocal
[info] Running HelloLocal
[INFO] [11/05/2014 12:42:32.674] [run-main-1] [Remoting] Starting remoting
[INFO] [11/05/2014 12:42:34.031] [run-main-1] [Remoting] Remoting started; listening on addresses :[akka.tcp://LocalSystem@127.0.0.1:45047]
[INFO] [11/05/2014 12:42:34.040] [run-main-1] [Remoting] Remoting now listens on addresses: [akka.tcp://LocalSystem@127.0.0.1:45047]
[WARN] [11/05/2014 12:42:34.367] [LocalSystem-akka.remote.default-remote-dispatcher-5] [akka.tcp://LocalSystem@127.0.0.1:45047/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FHelloRemoteSystem%40127.0.0.1%3A2552-0/endpointWriter] AssociationError [akka.tcp://LocalSystem@127.0.0.1:45047] -> [akka.tcp://HelloRemoteSystem@127.0.0.1:2552]: Error [Invalid address: akka.tcp://HelloRemoteSystem@127.0.0.1:2552] [
akka.remote.InvalidAssociation: Invalid address: akka.tcp://HelloRemoteSystem@127.0.0.1:2552
Caused by: akka.remote.transport.Transport$InvalidAssociationException: Connection refused: /127.0.0.1:2552
]
[WARN] [11/05/2014 12:42:34.419] [LocalSystem-akka.remote.default-remote-dispatcher-13] [Remoting] Tried to associate with unreachable remote address [akka.tcp://HelloRemoteSystem@127.0.0.1:2552]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: Connection refused: /127.0.0.1:2552
[INFO] [11/05/2014 12:42:34.451] [LocalSystem-akka.actor.default-dispatcher-2] [akka://LocalSystem/deadLetters] Message [java.lang.String] from Actor[akka://LocalSystem/user/LocalActor#1798933307] to Actor[akka://LocalSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
HelloRemote 错误是
[info] Running HelloRemote
Remote Actor receive messgage : The remote actor is alive
[INFO] [11/05/2014 12:42:35.654] [HelloRemoteSystem-akka.actor.default-dispatcher-2] [akka://HelloRemoteSystem/deadLetters] Message [java.lang.String] from Actor[akka://HelloRemoteSystem/user/RemoteActor#1925624739] to Actor[akka://HelloRemoteSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.