aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX Testing on Two Different Machines -RMI connection refused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX Testing on Two Different Machines -RMI connection refused" Watch "NX Testing on Two Different Machines -RMI connection refused" New topic
Author

NX Testing on Two Different Machines -RMI connection refused

Mehmet Atlihan
Greenhorn

Joined: Mar 03, 2004
Posts: 20
Hello all
I was wondering whether any of you tested your application other than localhost?
My application runs fine on localhost. But when I test it over internet
I got the following RMI error:
java.rmi.ConnectException: Connection refused to host: 192.168.0.1; nested exception is: java.net.ConnectException: Connection timed out: connect

This happens when a Remote Method is Invoked. Interestingly the application successfully looksup that is gets the remote objects reference
Does anyone know why this exception occurs ? Is it at server and or client end? The server has no firewall running so I dont see a practical reason
for a connection time out as the client can retrieve remote reference successfully.
Thank you
Mehmet
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

Hi Mehmet,
Do you really mean "over the internet"? Or do you mean over a local area network?
The reason I ask is that the 192.168.1.0/255.255.255.0 subnet is the class C private network address subnet, and is not routable over the internet.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Mehmet Atlihan
Greenhorn

Joined: Mar 03, 2004
Posts: 20
Hi Andrew
I mean WAN not LAN. So I start the server with the current WAN IP adress of his. Thats the same IP which client tries to connect to. I know 192.168.0.1 is not routable but it can be assigned and used locally. My guess is, upon connection RMI resolves the local IP of the server and attempts to gain access to it ?
I am trying to launch the server on another puter and have run in to problems again. This puter is connected to internet via a router. Whenever I attempt to start the server with the WAN IP , I am getting an error like this :
java.rmi.ServerException: RemoteException occurred in server thread; nested exce ption is:
java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /192.168.1.1 is non-local host

where 192.168.1.1 is the default gateway ,that is the routers local IP adress. Did anyone test his application over WAN where his server was behind a router ?
Last of all, as my application seems working on localhost and testing it on two different computers turned out to be too troublesome does it hurt to give up on it ? Did anyone submit his/her application without testing it over WAN and passed anyway ?
Your suggestions/experiences will be appreciated
Regards
Mehmet
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

Hi Mehmet,
Last of all, as my application seems working on localhost and testing it on two different computers turned out to be too troublesome does it hurt to give up on it ? Did anyone submit his/her application without testing it over WAN and passed anyway ?

Yes, I passed with only testing it on a LAN.
Many people here pass without even testing on a LAN. I have been considering adding two items to the FAQ: "can I submit without testing on other platforms", and "can I submit without testing connection from a separate machine".
By default, the rmiregistry appears to ignore the ipaddress in the server registration string, and just gives out the local ip address (which is non routable).
To get around this, you could try using the following parameter on your command line of your server:

Changing the "chatsubo.javasoft.com" to whatever your publically accessible hostname or IP address is.
Without this parameter, I was getting the same problem as you when connecting over a WAN: failure to connect to the private IP address. Once I put this parameter in, everything worked fine.
This hint came from the "RMI Through Firewalls Via Proxies" page.
Since this parameter needs to be set for the server only, you should be able to set it programattically before registering your server with the rmiregistry. However I don't think you need to go to that level of detail - people have been submitting without this "fix" for years and passing.
Regards, Andrew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX Testing on Two Different Machines -RMI connection refused