exporting two remote objects on the same port

Hi,

I would like to export two remote objects on the same host, same port and bind them with different service names.

There is no problem when I do that from the same Java program.

But when I export and bind an object from a Java program 1, I cannot do the same with the second (and similar) Java program 2. This is the stack trace of my Exception:

java.rmi.server.ExportException: Port already in use: 50040; nested exception is:

java.net.BindException: Address already in use: JVM_Bind

at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)

at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)

at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)

at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)

at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)

at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:129)

at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:275)

at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:178)

at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:75)

Can some one help please

[1280 byte] By [ali.chafik@infotel.coma] at [2007-10-3 3:56:57]
# 1

It should work in any version of Java as long as the server socket factories are null or equal according to Object.equals() or its override in the SSF.equals() method if any. Which needs to be present and needs to take the form:

public boolean equals(Object object)

{

return object != null && object.getClass() == this.getClass();

}

with further tests if the server socket factories have additional state.

ejpa at 2007-7-14 21:55:15 > top of Java-index,Core,Core APIs...