Header Ad

Thursday, August 23, 2018

java.lang.AbstractMethodError

Lets understand what it is:

AbstractMethodError Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.

How did I encounter java.lang.AbstractMethodError

Well I was having two spring project

  • UserLib : Lib which having core classes
  • MasterLib : Lib which is having dependency of UserLib
UserLib  had class

RegisterUser.java


public class RegisterUser{
public void register() {
// stuff to register
}
}
MasterLib was using RegisterUser class


public class UserService extends RegisterUser{ public  void doRegister() { UserService  user = new UserService (); user .register();
}
}

I had made build of UserLib  and run Master lib it worked; but for some reason I had make RegisterUser class as abstract class so I made it but, I forgot make build of UserLib and I simple run my masterLib, that is where I encountered this issue.

How to solve java.lang.AbstractMethodError : Either don't go for abstract method approach; or you just have implementation of the abstract class and don't forget to make build :) if you are have project structure like me.




No comments:

Post a Comment