Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

override problem

Thread view: 
Daniel - 17 Jun 2005 00:08 GMT
I want to implement rmi and get this error

test/PatientGui.java [151:1] getEnToonData() in test.PatientGui cannot
override getEnToonData() in test.ViewModel; overridden method does not throw
java.rmi.RemoteException

Public class PatientGui
 void getEnToonData() throws java.rmi.RemoteException
{

}

Public Class ViewModel

void getEnToonData()
  {
     System.out.println("Moet nog gemaakt worden in de sub-class");
  }

If i remove the throws java.rmi.RemoteException, the compiler tells me it
should be thrown.

How can i solve this?
Thanks

Daniel
Peter J. Grey - 17 Jun 2005 06:04 GMT
> I want to implement rmi and get this error
>
[quoted text clipped - 17 lines]
> If i remove the throws java.rmi.RemoteException, the compiler tells me it
> should be thrown.

I'm guessing that these classes implement java.rmi.Remote, either
explicitly or in their base classes.  RMI requires (if I remember right)
the throws java.rmi.RemoteException for a class implementing
java.rmi.Remote, so if it's in the base class, it will have to be in the
descendant class.

This is a little funny, because the usual rule is that if an exception
is thrown in the base class method, the subclass method can throw the
same exception, or any smaller set of exceptions (meaning a more
specific exception type), and this can include having no throws clause
at all in the subclass method.

Peter G
Daniel - 17 Jun 2005 08:17 GMT
Hello, yes the base class implements UnicastRemoteObject and the Interface
extends Remote,

But i dont know how to solve this, what should i change?
>> I want to implement rmi and get this error
>>
[quoted text clipped - 32 lines]
>
> Peter G
Peter J. Grey - 19 Jun 2005 03:42 GMT
> Hello, yes the base class implements UnicastRemoteObject and the Interface
> extends Remote,
> But i dont know how to solve this, what should i change?

It looks like you need
void getEnToonData() throw java.rmi.RemoteException
because if it's for RMI, then you would expect that a
java.rmi.RemoteException could come up.

Peter G


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.