File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes error: ObjID already in use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "error: ObjID already in use" Watch "error: ObjID already in use" New topic
Author

error: ObjID already in use

Along huang
Ranch Hand

Joined: Feb 09, 2004
Posts: 72
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.


SCJP1.4 SCJD 2<br />SCEA(In progressing)
mike acre
Ranch Hand

Joined: Sep 23, 2003
Posts: 197
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.


SCJP 1.4, SCJD
Walter Tang
Greenhorn

Joined: Aug 13, 2004
Posts: 25
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


SCJP
Wickes Potgieter
Ranch Hand

Joined: Apr 05, 2002
Posts: 68
I also get the same error...



Wickes Potgieter<br />SCJP<br />BEA Certified Specialist: Server, Integration, Portal, Tuxedo<br />BEA WebLogic Server 7 Certified Enterprise Developer<br />BEA Certified Architect<br /><a href="http://www.bea.com" target="_blank" rel="nofollow">www.bea.com</a>
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
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

Joined: Apr 05, 2002
Posts: 68
Is it possible to change the RMI Registry port number during runtime?
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error: ObjID already in use