Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server starting problem.

 
Yanxin Zhao
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi: everyone.
Sometimes my server starts fine, sometimes it does not.
I use "LocateRegistry.createRegistry(port);" to start my server, but just because of which method made me this problem. if port is 1099, my server starts fine; if port is not 1099, I have to use command "rmiregistry" in DOS before starts the server.
I want to know how to deal with my problem, I mean that do not using 1099 and any DOS command to start the server.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yanxin,
I suggest to use port 1099 exclusivly. It is the defautl port number, and in most case it will not be accupied by any other process.
You can document this choice, and you will have a good reason.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11833
181
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yanxin,

You should be able to use any port from within your program without problems. Perhaps you could give us some indication of what errors you see if you do not start an external remote registry? Or show us the code snippet for your starting the registry / registring & looking up your services.

I suspect that you are not specifying the port number in your registration URL. But without further information this is impossible to tell.

It is a good idea to learn how to specify alternate port numbers - otherwise you could end up in a situation where you cannot have more than one application per server . But for the purposes of this assignment, you could get away with hard coding the default port number.

Regards, Andrew
 
Yanxin Zhao
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, all.
My problem has been solved. At the beginning my code is that
LocateRegistry.createRegistry(2000);
Naming.rebind("//localhost/test", test);
but it is wrong, afterward, I change it into
LocateRegistry.createRegistry(2000).rebind("//localhost/test", test);
it works fine.

and in the client said, my right code is
LocateRegistry.getRegistry("localhost", 2000).lookup("//localhost/test");

now my code works fine. thanks for your reply again. : )
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic