| Author |
Problem with RemoteException
|
No�l Verdurmen
Ranch Hand
Joined: Jul 28, 2004
Posts: 33
|
|
Hi all, I have an interface DB as given by sun, and I have an interface RemoteDB that extends DB and java.rmi.Remote. In the class that is implementing RemoteDB (it also extends UnicastRemoteObject) I can only throw RemoteExceptions in the constructor. Adding a 'throw RemoteException' to the other methods will result in a compile-error. Why can't these methods throw a RemoteException, although the class (implicitly) implements the java.rmi.Remote interface? Any help is appreciated.
|
No�l
|
 |
No�l Verdurmen
Ranch Hand
Joined: Jul 28, 2004
Posts: 33
|
|
By the way, the RemoteDB interface is an empty interface. In the Habibi book, a similar approach is used. I don't quite see the difference.
|
 |
No�l Verdurmen
Ranch Hand
Joined: Jul 28, 2004
Posts: 33
|
|
Hmmm... I think I found out the problem. RemoteException is a subclass of IOException and therefore, in the Habibi book, the class implementing the java.rmi.Remote and the RemoteDB interface declares it in the throws-clause. That creates an other problem for me though. Since I wanted to expose the DB interface to the client exactly as it is described in the spec, I actually cannot do this without declaring a RemoteException in the throws-clause. And changing the DB interface to provide an extra Exception to be thrown seems not what the specification wants... I could, ofcourse, use the Adapter pattern to provide a similar interface to the client... (It is an interesting discussion with myself, but I wouldn't mind if somebody joined )
|
 |
mike acre
Ranch Hand
Joined: Sep 23, 2003
Posts: 197
|
|
Read this currently active thread It is discussing this issue in detail. Your interface structure for combining local & network modes is crucial in simplifying this problem.
|
SCJP 1.4, SCJD
|
 |
Marlene Miller
Ranch Hand
Joined: Mar 05, 2003
Posts: 1391
|
|
It is an interesting discussion with myself, but I wouldn't mind if somebody joined.
Please join us Noel on the other thread.
|
 |
 |
|
|
subject: Problem with RemoteException
|
|
|