• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX Testing on Two Different Machines -RMI connection refused

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Mehmet Atlihan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic