• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with already running RMIRegistry

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a RegisterDatabase class which starts an rmiregistry and binds my Data object to it.

If there is one running then I catch the exception and do getRegistry instead of a createRegistry.

Then I bind the object to the retrieved registry.

However when I try this I am getting the following exception:

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suncertify.remote.RemoteDBImpl_Stub


Not really sure how to solve this as the RemoteDBImpl_Stub does exist.

Any ideas ?

Thanks.
 
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alan, add a static boolean to RegisterDatabase that tells you whether or not the registry has been created.

Now if only all things in life were that simple
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alan,

The simplest way to handle this is to write in your design decision document that running with an externally started RMI Registry is possible, but it has not be detailed since doing so would contradict the instruction requirements .

Background information: The situation is that the rmiregistry needs to be able to find the stubs just in case a client requests them. So you have a choice - you can start the rmiregistry in the directory that contains your stub classes (or the start of the package directories that will allow it to find the stub classes), or start the registry with the command line option that allows you to specify the classpath for the stub classes.

That was a quick and dirty explanation since it is not really needed for the assignment - however it is something that you might need to know if you are creating RMI services in your real job. So if it is not making sense and you would like to know more, just say so. (I also think that Sun's RMI tutorial describes this - but it has been a long long time since I looked at it).

Regards, Andrew
 
Alan Morgan
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Monkhouse:
The simplest way to handle this is to write in your design decision document that running with an externally started RMI Registry is possible, but it has not be detailed since doing so would contradict the instruction requirements .




Hi Andrew,

Thanks for the reply.

So I should leave the code in there that would allow connection to an already running registry ?

Or just code for running with registry I started myself and document as you indicated.

How exactly would "doing so would contradict the instruction requirements" ?

Thanks again,

Alan.
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alan

How exactly would "doing so would contradict the instruction requirements" ?

Heh - I am probably being too conservative with my reading of the instructions (deliberately ). But given the restrictions on how you must start the server (no command line arguments other than "server", no manual editing of files, ...) I think that starting a separate process is going against the spirit of the instructions.

Regards, Andrew
reply
    Bookmark Topic Watch Topic
  • New Topic