File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object already exported exception with RMI

 
Gayatri Shende
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am trying to bind my RMI server to registry. I always get this exception saying object already exported.
I tried changing the port number of rmi registry. But didnt help.
Any HInts? Please help asap.

here is my code:

RMIClientSocketFactory rmiClientSocketFactory = new SslRMIClientSocketFactory();

RMIServerSocketFactory rmiServerSockeyFactory = new SslRMIServerSocketFactory();

IServer stub = (IServer) UnicastRemoteObject.exportObject(this, 0,

rmiClientSocketFactory, rmiServerSockeyFactory);

Registry registry = LocateRegistry.createRegistry(5255);

registry.rebind("MyServer", stub);



-Thanks
Gayatri
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gayatri,
Please UseCodeTags while posting code.
Does your server implementation extends UnicastRemoteObject? If yes, then you do not need to explicitly export it using UnicastRemoteObject.exportObject() methods. As soon as you initialize a class that extends UnicastRemoteObject, the object is exported by RMI.
If you try to export a class instance that extends UnicastRemoteObject, you will always get the exception that you have mentioned.
 
Gayatri Shende
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks .
It worked !

-Gayatri
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic