aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to start server at the port which not 1099? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to start server at the port which not 1099?" Watch "How to start server at the port which not 1099?" New topic
Author

How to start server at the port which not 1099?

shao zhimin
Greenhorn

Joined: Aug 07, 2002
Posts: 16
I use java.rmi.registry.LocateRegistry.createRegistry(int port) method in my server, but if the port is not 1099, i start server to get following error:
java.rmi.ConnectException: Connection refused to host:172.16.2.44;nested exception is:
java.net.ConnectException: Connection refused: connect
if i use the port "1099" ,the error is not throw.
why??
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Shao,
What port are you trying to use? Several things can cause a port connection to be refused. The most common two are:
1) Using a port number below 1024. Any port below 1024 requires super user or administrative access.
2) There is already a service bound to the port.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
shao zhimin
Greenhorn

Joined: Aug 07, 2002
Posts: 16
Thanks Michael for reply.
i check my code and find some error in
Naming.rebind(). my original code: Naming.rebind("Connection",connection); and modify:
Naming.rebind("//localhost ort/Connection",connection);
the program run well.
shao zhimin
Greenhorn

Joined: Aug 07, 2002
Posts: 16
Another Question:
i have three package: client, server, OnlineHelp.
i have an JEditorPane code in my client package and user document in the OnlineHelp package.
How to get URL in my JEditorPane code??
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
To get the URL for the html. You have to include the html file in the jar file and then use getClass().getResource("name of the html").
[ September 11, 2002: Message edited by: Samual Harvey ]

Samual Harvey<br />SCJP2<br />SCJD2
shao zhimin
Greenhorn

Joined: Aug 07, 2002
Posts: 16
Samual :
the JEditorPane code and the document must be in the same directory, is right?? If them pack the different directory, how to do it??
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
Originally posted by shao zhimin:
Samual :
the JEditorPane code and the document must be in the same directory, is right?? If them pack the different directory, how to do it??

No they can be in different directories. You should be able to access it. For testing create one html file inside your root directory and name it some weird name. Package the jar file and try this:-
URL url = this.getClass().getResource("weird.html");
If you move it in a directory then you need to chage the abv as getResource("dir/weird.html");

Easy way is two create you own html fiule in the root and put in the hyperlinks for the respective html files.
 
Don't get me started about those stupid light bulbs.
 
subject: How to start server at the port which not 1099?