File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Basic RMI problem 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 "Basic RMI problem" Watch "Basic RMI problem" New topic

Basic RMI problem

Stephen Cowell

Joined: Feb 07, 2002
Posts: 22
I've run into a weird problem and I can't find any old posts which address it.
I've created a "ConnectionFactory" class which extends UnicastRemoteObject and implements ConnectionInterface (which just declares a getConnection() method). The ConnectionFactory has a main method which instantiates a copy of itself and attempts to bind itself to the registry using Naming.rebind(name,app). I don't attempt to create or locate the registry in my code.
Next I compile it all and do a rmic on it and the stub files are created no problem. I then start the registry and then attempt to run the ConnectionFactory. However the problem is that seems to get stuck (ie doesn't through an exception, just hangs there) at the point in the line of code where it call Naming.rebind.
Any idea why?

My development environment is Linux.
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I am going to ask you a silly question. Do you call printStackTrace() inside the catch block to display any exception thrown because of the rebind() method?
Also try the following command before you start the rmiregistry:
set CLASSPATH="parent directory for all your packages".
Stephen Cowell

Joined: Feb 07, 2002
Posts: 22
Thanks for the reply.
Yes I do catch and print any exception. Here's the code

the last line of the output is "ConnectionFactory name = rmi://localhost:1099/ConnectionFactory
I tried the classpath option but it didn't seem ot make any difference.
[ April 16, 2002: Message edited by: Stephen Cowell ]
I agree. Here's the link:
subject: Basic RMI problem
It's not a secret anymore!