4

我是 akka 的新手,正在尝试让一个样本在多个 JVM 之间工作。我正在使用此处显示的示例,但遇到了问题。在下面的日志末尾,您可以看到一个 AssociationError,表示连接127.0.0.1:2552被拒绝。

15:35:24.543在日志WWW.XXX.YYY.ZZZ

15:35:24.307 [RandomOrgSystem-akka.actor.default-dispatcher-2] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
15:35:24.319 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG akka.event.EventStream - logger log1-Slf4jLogger started
15:35:24.320 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/UnhandledMessageForwarder#883086044]
15:35:24.320 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG akka.event.EventStream - Default Loggers started
15:35:24.320 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.e.LoggingBus$$anonfun$startDefaultLoggers$2$$anon$1 - started (akka.event.LoggingBus$$anonfun$startDefaultLoggers$2$$anon$1@45de530a)
15:35:24.325 [RandomOrgSystem-akka.actor.default-dispatcher-4] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/remoting-terminator#-1650950485]
15:35:24.339 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG a.r.RemoteActorRefProvider$RemotingTerminator - started (akka.remote.RemoteActorRefProvider$RemotingTerminator@4f27077b)
15:35:24.355 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/transports#300935452]
15:35:24.356 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG a.r.Remoting$TransportSupervisor - started (akka.remote.Remoting$TransportSupervisor@2cf5006)
15:35:24.359 [RandomOrgSystem-akka.actor.default-dispatcher-3] INFO  Remoting - Starting remoting
15:35:24.364 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/endpointManager#-594071077]
15:35:24.364 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.r.RemoteActorRefProvider$RemotingTerminator - now monitoring Actor[akka://RandomOrgSystem/system]
15:35:24.373 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG akka.remote.EndpointManager - started (akka.remote.EndpointManager@7ad99f4a)
15:35:24.534 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG a.r.Remoting$TransportSupervisor - now supervising Actor[akka://RandomOrgSystem/system/transports/akkaprotocolmanager.tcp0#-2000194523]
15:35:24.537 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG a.r.transport.AkkaProtocolManager - started (akka.remote.transport.AkkaProtocolManager@749cd006)
15:35:24.543 [RandomOrgSystem-akka.actor.default-dispatcher-5] INFO  Remoting - Remoting started; listening on addresses :[akka.tcp://RandomOrgSystem@WWW.XXX.YYY.ZZZ:2552]
15:35:24.545 [RandomOrgSystem-akka.actor.default-dispatcher-2] INFO  Remoting - Remoting now listens on addresses: [akka.tcp://RandomOrgSystem@WWW.XXX.YYY.ZZZ:2552]
15:35:24.548 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/remote-watcher#-245042739]
15:35:24.549 [RandomOrgSystem-akka.actor.default-dispatcher-2] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/remote-deployment-watcher#1846115901]
15:35:24.550 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG akka.remote.RemoteDeploymentWatcher - started (akka.remote.RemoteDeploymentWatcher@730a4a32)
15:35:24.550 [RandomOrgSystem-akka.actor.default-dispatcher-4] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://RandomOrgSystem/system/deadLetterListener#1544852868]
15:35:24.552 [RandomOrgSystem-akka.actor.default-dispatcher-4] DEBUG akka.event.DeadLetterListener - started (akka.event.DeadLetterListener@79a422d9)
15:35:24.555 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG akka.remote.RemoteWatcher - started (akka.remote.RemoteWatcher@4aa0560e)
15:35:24.555 [RandomOrgSystem-akka.actor.default-dispatcher-5] INFO  akka.actor.ActorSystemImpl - Started
15:35:24.559 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG a.a.LocalActorRefProvider$Guardian - now supervising Actor[akka://RandomOrgSystem/user/buffer#-400157724]
15:35:24.570 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG RemoteActorRefProvider - [akka://RandomOrgSystem/] Instantiating Remote Actor [akka.tcp://RandomOrgSystem@127.0.0.1:2552/remote/akka.tcp/RandomOrgSystem@WWW.XXX.YYY.ZZZ:2552/user/buffer/client]
15:35:24.581 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG akka.remote.RemoteWatcher - Watching: [akka://RandomOrgSystem/system/remote-deployment-watcher -> akka.tcp://RandomOrgSystem@127.0.0.1:2552/remote/akka.tcp/RandomOrgSystem@WWW.XXX.YYY.ZZZ:2552/user/buffer/client]
15:35:24.582 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG c.b.n.akka.demo.RandomOrgBuffer - started (com.blogspot.nurkiewicz.akka.demo.RandomOrgBuffer@3012db7c)
15:35:24.584 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG akka.remote.EndpointManager - now supervising Actor[akka://RandomOrgSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FRandomOrgSystem%40127.0.0.1%3A2552-0#-126941538]
15:35:24.594 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG a.remote.ReliableDeliverySupervisor - started (akka.remote.ReliableDeliverySupervisor@b8235a1)
15:35:24.594 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG a.remote.ReliableDeliverySupervisor - now monitoring Actor[akka://RandomOrgSystem/system/endpointManager#-594071077]
15:35:24.594 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG a.remote.ReliableDeliverySupervisor - now supervising Actor[akka://RandomOrgSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FRandomOrgSystem%40127.0.0.1%3A2552-0/endpointWriter#118183353]
15:35:24.606 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG akka.remote.EndpointWriter - started (akka.remote.EndpointWriter@4b069693)
15:35:24.606 [RandomOrgSystem-akka.actor.default-dispatcher-5] DEBUG akka.remote.EndpointWriter - now monitoring Actor[akka://RandomOrgSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FRandomOrgSystem%40127.0.0.1%3A2552-0#-126941538]
15:35:24.616 [RandomOrgSystem-akka.actor.default-dispatcher-3] DEBUG a.r.transport.AkkaProtocolManager - now supervising Actor[akka://RandomOrgSystem/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2FRandomOrgSystem%40127.0.0.1%3A2552-1#-1464884820]
15:35:24.631 [RandomOrgSystem-akka.actor.default-dispatcher-4] DEBUG a.r.transport.ProtocolStateActor - started (akka.remote.transport.ProtocolStateActor@620b5b80)
15:35:24.656 [RandomOrgSystem-akka.actor.default-dispatcher-5] ERROR akka.remote.EndpointWriter - AssociationError [akka.tcp://RandomOrgSystem@WWW.XXX.YYY.ZZZ:2552] -> [akka.tcp://RandomOrgSystem@127.0.0.1:2552]: Error [Association failed with [akka.tcp://RandomOrgSystem@127.0.0.1:2552]] [
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://RandomOrgSystem@127.0.0.1:2552]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$anon$2: Connection refused: /127.0.0.1:2552
]

如果远程处理在本地主机地址上开始,我会喜欢它,这样我在更改 IP 地址时就不必重新配置。我的application.conf包含:

akka {
    log-config-on-start = off
    loggers = ["akka.event.slf4j.Slf4jLogger"]
    loglevel = "DEBUG"
    actor {
        provider = "akka.remote.RemoteActorRefProvider"
        debug {
            receive = on
            autoreceive = on
            lifecycle = on
            unhandled = on
        }
        deployment {
            /buffer/client {
                remote = "akka.tcp://RandomOrgSystem@127.0.0.1:2552"
            }
        }
    }
    remote {
        transport = "akka.remote.netty.NettyRemoteTransport"
        log-sent-messages = on
        netty {
            hostname = "127.0.0.1"
        }
    }
}

谢谢,汤姆

4

1 回答 1

4

尝试将您的remote部分更改为:

remote {
    transport = "akka.remote.netty.NettyRemoteTransport"
    log-sent-messages = on
    netty.tcp {
        hostname = "127.0.0.1"
    }
}

因为配置错误并且你没有指定hostname属性,所以默认使用主机ip。如上所述设置配置将允许您使用环回。

于 2013-08-16T23:55:29.160 回答