Search code examples
socketstcpakkaakka-clusterakka-remote-actor

Akka Remoting Connection


I have 2 applications say app1 and app2. On machine 1, both app1 and app2 runs but on machine 2 only app2 runs, as most of the work is done by app2. The apps use Akka.

Using akka remoting, I want to be able to pass message from app1 on machine 1 to app2 on machine 2. app1 and 2 are able to interact with each other when they are on same machines.

However when app 1 on machine 1 tries to connect with app2 on machine 2 it gets below error...

EndpointWriter - AssociationError [akka.tcp://[email protected]:4242] -> [akka.tcp://deal@:4241]: Error [Invalid address: akka.tcp://deal@:4241] [ akka.remote.InvalidAssociation: Invalid address: akka.tcp://deal@:4241 Caused by: akka.remote.transport.Transport$InvalidAssociationException: Connection refused: /:4241

When I run netstat -a | egrep 'Proto|LISTEN' on machine 2, I got below response tcp6 0 0 localhost:4241 [::]:* LISTEN

This indicates that the app2 is running and able to listen on 4241.

Also, the port 4241 is open on machine1 and 2.

Any suggestion will be helpful. Thanks.


Solution

  • It looks like your app is bound to localhost interface on machine 2. It should bind to a public interface instead (something like 192.168...., not 127.0.0.1/localhost) to be accessible to outside network. You can telnet into it to check:

    telnet machine2hostname 4241