Rmi by Internet connection

Reply

Join Date: Feb 2007
Posts: 35
Reputation: Venks is an unknown quantity at this point 
Solved Threads: 0
Venks's Avatar
Venks Venks is offline Offline
Light Poster

Rmi by Internet connection

 
0
  #1
Apr 23rd, 2008
Hai Friends

Iam using RMI concept for my project, i want to connect client and server by using internet connection , but its working fine on LAN connection, it gives following Exception
  1. java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to hos
  2. t: 125.17.11.229; nested exception is:
  3. java.net.ConnectException: Connection refused: connect
  4. at Client.init(Client.java:23)
  5. at sun.applet.AppletPanel.run(AppletPanel.java:417)
  6. at java.lang.Thread.run(Thread.java:619)
  7. Caused by: java.rmi.ConnectException: Connection refused to host: 125.17.11.229; n
  8. ested exception is:
  9. java.net.ConnectException: Connection refused: connect
  10. at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
  11. at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198
  12. )
125.17.11.229 is my internet IP

my code
  1. Server:
  2. import java.rmi.registry.LocateRegistry;
  3. import java.rmi.registry.Registry;
  4. import java.rmi.server.UnicastRemoteObject;
  5.  
  6. public class Server implements RemoteInterface
  7. {
  8.  
  9. public String getMessage()
  10. {
  11. return "Hello World";
  12. }
  13.  
  14. public static void main(String args[])
  15. {
  16. try
  17. {
  18. String REGISTRY_NAME = "RMI_Example";
  19. int REGISTRY_PORT = 3032;
  20. Registry registry = LocateRegistry.getRegistry(REGISTRY_PORT);
  21. RemoteInterface remoteReference =
  22. (RemoteInterface) UnicastRemoteObject.exportObject(new Server());
  23. registry.rebind(REGISTRY_NAME, remoteReference);
  24. }
  25. catch (Exception e)
  26. {
  27. throw new RuntimeException(e);
  28. }
  29. }
  30. }
  31.  
  32. Interface:
  33.  
  34. import java.rmi.Remote;
  35. import java.rmi.RemoteException;
  36.  
  37. public interface RemoteInterface extends Remote
  38. {
  39. String getMessage() throws RemoteException;
  40. }
  41.  
  42.  
  43. client:import java.rmi.registry.LocateRegistry;
  44. import java.rmi.registry.Registry;
  45. import javax.swing.JApplet;
  46. import javax.swing.JLabel;
  47. import java.rmi.*;
  48.  
  49. public class ClientApplet
  50. {
  51.  
  52. public static void main(String arg[])
  53. {
  54. String REGISTRY_NAME = "RMI_Example";
  55. int REGISTRY_PORT = 3032;
  56.  
  57. try
  58. {
  59. Registry registry =
  60. LocateRegistry.getRegistry("125.17.11.229",REGISTRY_PORT);
  61. RemoteInterface remoteReference =
  62. (RemoteInterface) registry.lookup(REGISTRY_NAME);
  63. System.out.println(remoteReference.getMessage());
  64. }
  65. catch (Exception e)
  66. {
  67. throw new RuntimeException(e);
  68. }
  69. }
  70. }
plz help me for this problem...
Last edited by ~s.o.s~; Apr 30th, 2008 at 3:01 pm. Reason: Added code tags, learn to use them.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,648
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 283
Moderator
masijade's Avatar
masijade masijade is online now Online
Posting Maven

Re: Rmi by Internet connection

 
0
  #2
Apr 23rd, 2008
Firewall?
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,490
Reputation: jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all 
Solved Threads: 237
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Rmi by Internet connection

 
0
  #3
Apr 23rd, 2008
either that or the server process is bound to the local network address and therefore trying to call the process through its external address isn't going to get a response.
42
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 35
Reputation: Venks is an unknown quantity at this point 
Solved Threads: 0
Venks's Avatar
Venks Venks is offline Offline
Light Poster

Re: Rmi by Internet connection

 
0
  #4
Apr 29th, 2008
When iam using external ip(125.17.11.232) to connect server its working fine in LAN but it gives error when iam try to run in internet connection
Exception in thread "main" java.lang.RuntimeException: java.rmi.ConnectIOExcepti
on: Exception creating connection to: 194.9.30.245 nested exception is:

In error show my server local ip 194.9.30.245 ,

coding:
Server :
Server.java

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

public class Server implements RemoteInterface
{

public String getMessage()
{
return "Hello World";
}

public static void main(String args[])
{
try
{
String REGISTRY_NAME = "RMI_Example";
int REGISTRY_PORT = 60020;
Registry registry = LocateRegistry.getRegistry(REGISTRY_PORT);
RemoteInterface remoteReference =
(RemoteInterface) UnicastRemoteObject.exportObject(new Server());
registry.rebind(REGISTRY_NAME, remoteReference);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
--------------------------------------
Interface
RemoteInterface.java

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface RemoteInterface extends Remote
{
String getMessage() throws RemoteException;
}
-----------------------------------------------------------
Client

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import javax.swing.JApplet;
import javax.swing.JLabel;
import java.rmi.*;

public class ClientApplet
{

public static void main(String arg[])
{
String REGISTRY_NAME = "RMI_Example";
int REGISTRY_PORT = 60020;

try
{
Registry registry =
LocateRegistry.getRegistry("125.17.11.232",REGISTRY_PORT);
RemoteInterface remoteReference =
(RemoteInterface) registry.lookup(REGISTRY_NAME);
System.out.println(remoteReference.getMessage());
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}

Please send me solution for this problem
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 35
Reputation: Venks is an unknown quantity at this point 
Solved Threads: 0
Venks's Avatar
Venks Venks is offline Offline
Light Poster

Re: Rmi by Internet connection

 
0
  #5
Jul 2nd, 2008
any solution for this problem...
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,648
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 283
Moderator
masijade's Avatar
masijade masijade is online now Online
Posting Maven

Re: Rmi by Internet connection

 
0
  #6
Jul 2nd, 2008
Maybe, if you were to show what the nested exception is.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 35
Reputation: Venks is an unknown quantity at this point 
Solved Threads: 0
Venks's Avatar
Venks Venks is offline Offline
Light Poster

Re: Rmi by Internet connection

 
0
  #7
Jul 3rd, 2008
java.rmi.ConnectIOException: Exception creating connection to: 194.9.30.242; nested exception is:
java.net.NoRouteToHostException: No route to host: connect
this is my Exception
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,648
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 283
Moderator
masijade's Avatar
masijade masijade is online now Online
Posting Maven

Re: Rmi by Internet connection

 
0
  #8
Jul 3rd, 2008
That is, seemingly, not a publicly available ip address (i.e. can't be reached from the internet, at all), or you are attempting it to access throught the wrong interface on your computer, and so have no network path to it.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 35
Reputation: Venks is an unknown quantity at this point 
Solved Threads: 0
Venks's Avatar
Venks Venks is offline Offline
Light Poster

Re: Rmi by Internet connection

 
0
  #9
Jul 3rd, 2008
im using public ip in my client,what are the changes that i have to do in my program? in client or server program?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3023 | Replies: 8
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC