• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to start server at the port which not 1099?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
shao zhimin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
shao zhimin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic