aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Server starting problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Server starting problem." Watch "Server starting problem." New topic
Author

Server starting problem.

Yanxin Zhao
Ranch Hand

Joined: May 05, 2004
Posts: 65
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

Joined: Aug 20, 2003
Posts: 532
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.


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11481
    
  94

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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Yanxin Zhao
Ranch Hand

Joined: May 05, 2004
Posts: 65
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
 
subject: Server starting problem.