Getting java.lang.AbstractMethodError on implemented method

后端 未结 3 996
无人共我
无人共我 2020-12-21 09:36

As the title states, I get a java.lang.AbstractMethodError on a method that is definitively implemented by my class. The complete error message is:



        
相关标签:
3条回答
  • 2020-12-21 10:10

    The problem was that the implementing class was not compiled correctly and the Ant script did not copy the correct class into the jar-file. I converted it to a maven project and now the method can be found.

    0 讨论(0)
  • 2020-12-21 10:22

    if your implementing class's jar is not in the classpath or not sure

    try like below code

        YourInterfaceName obj = (YourInterfaceName)Class.forName
    ("yourPackageName.YourInterfaceImplClassName").newInstance();
    
    0 讨论(0)
  • 2020-12-21 10:33

    Make sure you have the latest jar file in your class path not a older copy. If you are seeing this at run time this happens due to incompatible binaries

    From Oracle java site

    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.

    Link to Class AbstractMethodError

    Also try the -U flag forces to update dependencies.

    mvn clean install -U
    
    0 讨论(0)
提交回复
热议问题