Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

Running RMI Server on Different Port - binding issues

Thread view: 
andy.troutman@gmail.com - 28 Jul 2005 05:41 GMT
Hey all,
I've got a RMI client and server application with both the cliet and
server running on localhost. Getting everything running at the same
time hasn't been a problem unless I try to specify a different port
other than 1099 (default port). Here are the steps I take to try and
get the server up and running: (trying this on a winxp home edition
box)

from command prompt I run: rmiregistry 1005

I then execute my rmi server from eclipse, and I get the following
exception:
java.rmi.server.ExportException: Port already in use: 1005; nested
exception is:
    java.net.BindException: Address already in use: JVM_Bind
    at sun.rmi.transport.tcp.TCPTransport.listen(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.exportObject(Unknown Source)
    at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unknown Source)
    at sun.rmi.transport.LiveRef.exportObject(Unknown Source)
    at sun.rmi.server.UnicastServerRef.exportObject(Unknown Source)
    at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source)
    at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source)
    at com.networkprogramming.rmi.Quote.<init>(Quote.java:35)
    at com.networkprogramming.rmi.QuoteServer.main(QuoteServer.java:25)
Caused by: java.net.BindException: Address already in use: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(Unknown
Source)
    at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(Unknown
Source)
    at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(Unknown Source)

The line of code that the exception is originating from is:
UnicastRemoteObject.exportObject(this, portNumber);
where port number is also 1005.

Note that if I simply run rmiregistry followed by
UnicastRemoteObject.exportObject(this);
i.e. I don't specify a port, everything goes off without a hitch.
I've tried a few different configurations but nothing seems to get me
beyond this point... Any insite would be appreciated.
Thanks,
Andy
Esmond Pitt - 28 Jul 2005 08:20 GMT
(a) Why run the Registry with a different port? what's wrong with 1099?
(b) Why do you care what port the RMI server listens on?

Use a single Registry on port 1099 and let the servers choose their own
port numbers

UNLESS

you have to deal with a firewall, in which case you should start the
Registry from within the server JVM using
LocateRegistry.createRegistry(). In this case as long as you don't get
in the way with socket factories the Registry *and* all the RMI servers
in the JVM will use port 1099.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.