• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI Server/Client example on Server 2012 and Home PC  RSS feed

 
Eldrid Chapman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

For our academic project, we are intending to have a RMI-based program running on Amazon EC2 server(windows server 2012).
As we just created the ec2 yesterday, we are trying a sample program to make sure we understand the connections.

I tried the sample program at http://www.cs.uic.edu/~troy/fall06/cs441/rmi/index.html.

I modified the sample code to change the localhost to the server's IP address for CalculatorClient



The CalculatorServer's address remain as localhost.

I compiled all files, created the stub and skeleton files on both my client PC and ec2 server. On the server I have configured all IP addresses to be allowed, and port 1099 open(just for now)
On the server PC, the stub is created successfully and the server is (presumely) waiting for a connection as there are no error message.

On my client PC, I am not able to connect to the server. Error message is:

RemoteException
java.rmi.ConnectException: Connection refused to host: 172.31.10.234; nested exc
eption is:
java.net.ConnectException: Connection refused: connect

May I know why it is not working?
 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: since Java 1.5 you don't need to generate stub and skeleton classes as they are now auto generated at runtime. There's no harm in doing so but it's isn't compulsory anymore.

As to your problem, have you started the RMI Registry and if so where is it running and are you sure the URL's you are using are correct (the exception appears to show a different URL to your code)?
 
Eldrid Chapman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Docherty wrote:Note: since Java 1.5 you don't need to generate stub and skeleton classes as they are now auto generated at runtime. There's no harm in doing so but it's isn't compulsory anymore.

As to your problem, have you started the RMI Registry and if so where is it running and are you sure the URL's you are using are correct (the exception appears to show a different URL to your code)?


Hi there, 172.31.10.234 is actually a private internal network address and I have no idea what is that particular address for.
On server side, the RMI registry file was at the same directory as the server file. Both server file and rmi registry started and did not show any error message after some time,as per screenshot.



On the client side, if I dont generate the stub file via rmic CalculatorImpl, i get this error (which does not show if the stub file is generated):
RemoteException
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: CalculatorImpl_Stub (no security manag
er: RMI class loader disabled)


After launching the client program, this message shows after a while
RemoteException
java.rmi.ConnectException: Connection refused to host: 172.31.10.234; nested exc
eption is:
java.net.ConnectException: Connection refused: connect


Port 1099 is open on server PC and my PC.

 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried pinging the server from the client?

On the client side, if I dont generate the stub file via rmic CalculatorImpl, i get this error (which does not show if the stub file is generated):

What version of Java are you using?

Are you using the same name to bind and lookup the CalculatorService, you've changed the name in the lookup have you also changed it on the rebind call.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!