This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error: ObjID already in use

 
Along huang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I occur a RMI problem, it push me into a dilemma.

When starting, application run the following code segment:
int rmiPort = 1099;
Registry reg = LocateRegistry.createRegistry(rmiPort);
reg.rebind("theRemoteObj",remoteObj);

it run well. After application start over, user change the variable "rmiPort" through UI, now application run the above code segment again, then throws the error:
java.rmi.server.ExportException: internal error: ObjID already in use

I attempt to use "LocateRegistry.getRegistry(rmiPort)" method, but it always return a non-null value even though no any Registry is created.

How to solve the problem?

Appendix: My design thought is that system allow user to change Port, server address and Database File.

best regards.
 
mike acre
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too had this problem, I really believe there is a limitation in the rmi implementation that prevents createRegistry in the same JVM more than once for ANY port.

After a while playing with this, I made my app start under any port, but when it was stopped, it unexport and unbind that port and closed the app.

Change port? Fine, but you have to start the JVM again.
 
Walter Tang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mike acre:
I too had this problem, I really believe there is a limitation in the rmi implementation that prevents createRegistry in the same JVM more than once for ANY port.

After a while playing with this, I made my app start under any port, but when it was stopped, it unexport and unbind that port and closed the app.

Change port? Fine, but you have to start the JVM again.


I faced the same problem as well this morning. I use the static method unexport in UnicastRemoteObject to unexport the remote object. and unbind the service. But still can not change port. recently, my program can only allow the client to use one port at once. otherwise, have to start the program again. That is really what I expected. Anyone can tell me what I can do to change port at running time? or solve the "error: ObjID already in use" problem. Thanks in advanced.

Regards,
Walter
 
Wickes Potgieter
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also get the same error...

 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by peter wooster:

I tried many different approaches to this after searching the Sun Java RMI forum on the topic. It appears that you cannot change the port once its open, you will have to shut down your server and restart after making the change. You can get past the ObjID problem, but the new registry does not work.

You could use Runtime.exec to start the registry, but that opens up a whole different can of worms.

I reread my project instructions and I can see no need to change the port, you either can create a registry on 1099 or you can get one. If you can't do either of those, then you should "contact your network administrator".

I don't actually let my server do any configuration, and it has no GUI. the only configuration available is the database file name and the user can use the standalone client GUI to configure and test this.



This reply to myself is to get the incorrectly dated reply back in order.
/pkw
 
Wickes Potgieter
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to change the RMI Registry port number during runtime?
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Wickes Potgieter:
Is it possible to change the RMI Registry port number during runtime?


I tried many different approaches to this after searching the Sun Java RMI forum on the topic. It appears that you cannot change the port once its open, you will have to shut down your server and restart after making the change. You can get past the ObjID problem, but the new registry does not work.

You could use Runtime.exec to start the registry, but that opens up a whole different can of worms.

I reread my project instructions and I can see no need to change the port, you either can create a registry on 1099 or you can get one. If you can't do either of those, then you should "contact your network administrator".

I don't actually let my server do any configuration, and it has no GUI. the only configuration available is the database file name and the user can use the standalone client GUI to configure and test this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic