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

Question about RMI Server???

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope I can specify different port for RMI server, but now I can only specify 1099 port. Using command lind: java MyRMIServer db.db 1099,it can run normally. However, using command lind following:java MyRMIServer db.db 5001,error occurred:MyRMIServer error: Connection refused to host: 127.0.0.1; nested exception
is:
java.net.ConnectException: Connection refused: connect
Why?how to fix it?
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
couple of things:
1. it depends on how you start your registry service. You can start it programmatically by doing:
registry = LocateRegistry.createRegistry(portNum);
if you start you registry on another port then the one that you try to start the rmiserver then it will not work. I havent tested if that will result in your error.
2. The other thing about your code is that you are only checking if your args.length is not null. You are not checking if it has one two or three arguments. If at command line you only supply one argument, your code will fail. I do agree that you are telling the user to supply two arguments, but we are dealing with stupid users (as michael Morris tend to say ) So check both arguments/or none at all.
hope it all helps.
regards.friso
 
Richard Phen
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you friso jonge!
Your clear answer is very helpful to me!
Thank you again!
    Bookmark Topic Watch Topic
  • New Topic