Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Declaring a remote interface and RMIC

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have what I thought was a framework that would allow me to create a client/server application where the server could either reside remotely or operate locally, as part of the client component. I created the following classes and interfaces to accomodate local and remote access to the server:



As you can see the methods in Service all throw ServiceException. This is fine if LocalService is to be Service's only implementation; however, since it is extended by RemoteService with the intention of using it as a remote object, its methods should also throw RemoteException. Right? I thought I solved this as follows:



However, when I invoke rmic on RMIService I get the following errors:



I don't understand how this can be since I've defined ServiceException to extend RemoteException, so ServiceException IS A RemoteException. What am I missing here?

Also, I'm already just about finished with the local version of the application so I'm hoping that there is something I can do that will not require me to do too much rewriting, if any. Any feedback appriciated.

Rich
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem itself was very fundamental;
You should declare each method in Service interface throwing RemoteException
while implimenting RMIService class you can still throw ServiceException Object as Service Exception is derived from RemoteException;
so change in declaration is not going to affect your implimentation
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic