Search code examples
javaamazon-ec2rmi

Java RMI - Lookup Success , but method call fails - Onpremise Vs AWS


I have a java code which makes connection to a Java RMI server - lookup followed by method invocation. Both machine are under the same firewall in onpremise and works as expected. When my client/java moved to AWS, the RMI server is still running in on-premise.. But here in this case, it fails with below error..

Lookup success, method call failed.. 

Lookup for Remote Object Successful.

ErrorMessage:startupFunction : RemoteException Caught.. Connection refused to host: XXXXX ; nested exception is:
    java.net.ConnectException: Connection timed out

PS : I see similiar issue in this post, but nothing seems to work in my case


Solution

  • You need to export your remote object on a fixed port, and open that port in your firewall.