Akka 2.6.9 Artery Implementation listening on default port always i.e. 25502

I am using Akka 2.6.9 version in Java project. Project consist of multiple modules having port 2551 for 1st module and 2552 port for 2nd module with a common hostname(localaddress) and fetching the values dynamically like below in application.conf

  1. akka {
  2. actor {
  3. provider = remote
  4. }
  5. remote {
  6. artery {
  7. enabled = on
  8. canonical.hostname = ${hostname}
  9. canonical.port = ${port}
  10. }
  11. }
  12. }
    Logs:
    [ArteryTcpTransport (akka://sys)] Remoting started with transport [Artery tcp]; listening on address [akka://sys@127.0.0.0.1:25520] with UID [6678542467887787]

Problem: On starting both the modules it is always listening on the port 25520 not taking 2551 or 2552. Because of this One module starts fine but I am getting address already in use Exception for the other module.

Can anyone please help?

How do you assign the ${port}?
One way would be to start java with -Dakka.remote.artery.canonical.port=2552

Thanks its working now.

Both the modules have been started.
When sending message to the destination address it is showing below Handshake exception
InboundHandshake$$anon$2(akka://module2)
"Dropping Handshake Request from [{akka://module1}] addressed to unknown local address [{akka://module2}]. " +
"Local address is [{akka://module2}]. Check that the sending system uses the same " +
"address to contact recipient system as defined in the " +
"‘akka.remote.artery.canonical.hostname’ of the recipient system. " +
“The name of the ActorSystem must also match.”,

Could you please suggest?