gpt4 book ai didi

scala - Akka AssociationError - LAN 地址与本地主机

转载 作者:行者123 更新时间:2023-12-01 01:06:35 25 4
gpt4 key购买 nike

我是 akka 的新手,正在尝试让一个示例在多个 JVM 之间工作。我在 example shown here 工作但我遇到了问题。在下面日志的末尾,您可以看到在 AssociationError 中,说 connection to 127.0.0.1:2552被拒绝了。

在日志的前面( 15:35:24.543 ),我看到远程处理已启动,并且正在监听我的 LAN 地址(我已显示为 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"
}
}
}

谢谢,
汤姆

最佳答案

尝试更改您的 remote部分到:

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

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

关于scala - Akka AssociationError - LAN 地址与本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18281182/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com