Search code examples
javaoopmiddlewarecorbaidl

Not abstract and does not override abstract method - IDL


I am developing a CORBA application using Java. I am using 'idlj' to generate stubs and skeletons. While compiling I get this error.

Account.java:12: error: Account is not abstract and does not override abstract method _all_interfaces(POA,byte[]) in Servant
public class Account extends org.omg.PortableServer.Servant
       ^
Note: SMTS/AccountPOA.java uses unchecked or unsafe operations.

And These are the class definitions and idl definitions.

SMTS.idl file

module SMTS{
    interface Account{
        attribute string accountID;
        attribute double balance;
        void setAccountID(inout string accid);
        void setBalance(inout double value);
    };
};

Account.java class

public class Account extends AccountPOA{
    private ORB orb;
    private String accountID;
    private double balance;
    public void setORB(ORB orb_val){
        orb = orb_val;
    }
    public void setAccountID(String accid){
        this.accountID = accid;
    }
    public void setBalance(double value){
        this.balance = value;
    }
}

Solution

  • The class AccountPOA or one of its super classes has one or more abstract methods that haven't been overridden. If you extend an abstract class containing abstract methods, you're obliged to override all abstract methods. The only exception is if your class itself is abstract. As long as you have a concrete class (=not abstract) that can be instantiated, you must override all abstract methods.

    So, have a look at the code of AccountPOA and all classes and interfaces it's extending or implementing. Somewhere there must be an abstract method that hasn't been overridden in the class hierarchy.