This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

RMI Server/Client example on Server 2012 and Home PC

 
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?
 
Bartender
Posts: 3323
86
  • 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: 3323
86
  • 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.
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic