Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic RMI problem

 
Stephen Cowell
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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?
Thanks.

My development environment is Linux.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic