Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about RMI Server???

 
Richard Phen
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?
 
friso jonge
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic