• 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

why i cannot bind the server in other port

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
Recently I try to bind the RMI server with other port rather than 1099, but it fails with: Connection refused to host: 218.244.114.87; nested exception is:
java.net.ConnectException: Connection refused: connect
the code for starting server is like below
try {
java.rmi.registry.LocateRegistry.createRegistry(port);
} catch(RemoteException re) {
Util.log("Create Registry error.");
re.printStackTrace();
}
try {
FBNServer server = new FBNServer(db);
// Bind this object instance to the name "FBNServer"
Naming.rebind("FBNServer", server);
...} catch(IOException e){}
The exception thrown in the second try block.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have another service running on the 'new' port.
If you are using Windows NT/2000/XP then try this command: netstat -a
You should now see all port in use.
Rene
 
Jane Wang
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks but it still doesn't work.
 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
https://coderanch.com/t/179372/java-developer-SCJD/certification/RMI-Port-Number
That is how I fixed my problem.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


java.rmi.registry.LocateRegistry.createRegistry(port);
FBNServer server = new FBNServer(db);
Naming.rebind("FBNServer", server);


Try this instead, it should work:
java.rmi.registry.LocateRegistry.createRegistry(port);
FBNServer server = new FBNServer(db);
Registry registry = LocateRegistry.getRegistry(port);
registry.rebind("FBNServer", server);
Eugene.
[ January 01, 2003: Message edited by: Eugene Kononov ]
 
Jane Wang
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much!
I try registry.rebind instead of Naming.rebind and it works.
Question is why?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic