BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RMI - Naming:lookup & rebind conflict

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder CORBA/RMI
View previous topic :: View next topic  
Author Message
Petar
Guest





PostPosted: Sun Sep 14, 2003 8:13 am    Post subject: RMI - Naming:lookup & rebind conflict Reply with quote



Hi,

I have problem that rebind fails after calling lookup. Why, and what to do
in the between to prevent this from happening. More deails follows.

Thanks.

====DETAILS===
RMI server needs to know if there is an instance already running. If not it
continues witn binding. Here is how I do it.

try {
IIMServer oldServer =
(IIMServer)Naming.lookup("//localhost:1099/applications/XYServer/IMSERVER");
if (oldServer.ping()) {
System.out.println("Server already running. Bye.");
System.exit(-1);
}
} catch (Exception e) {
System.out.println("no old server.");
}


This above part works fine. However the following does fail and the flow
turns into
the exception and finally exits with -1.

System.setSecurityManager(new RMISecurityManager());
URL url = ClassLoader.getSystemResource("classes"); // app's root dir
must be in classpath !!
System.setProperty("java.rmi.server.codebase", url.toString()+"/");
try {
Naming.rebind("//localhost:1099/applications/XYServer/IMSERVER",
this);
} catch (Exception e) {
e.printStackTrace();
System.exit( -1);
}
System.out.println("Server created.");

It is fascinating that if I remove first part of code (which seeks for old
instance of server)
the second part works perfectly. (btw: policy and codebase are set nicely
and properly).

Why does that happen ? I am astonished. If anyone had this problem please
let me know the solution.

Kindest regards
Petar.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder CORBA/RMI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.