48

What are the possible causes for ABstractMethodError?

Exception in thread "pool-1-thread-1" java.lang.AbstractMethodError:

org.apache.thrift.ProcessFunction.isOneway()Z
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:51)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
    at com.gemfire.gemstone.thrift.hbase.ThreadPoolServer$ClientConnnection.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
dda
  • 6,030
  • 2
  • 25
  • 34
Avinash
  • 12,851
  • 32
  • 116
  • 186
  • 1
    Give us some context , what are you trying to do ? May be some version issue ! The method that you invoke or some other code invokes is converted into an abstract method now . – AllTooSir Jul 31 '13 at 11:44
  • I was trying out hbase thrift version. I build thrift compiler and generated thrift files. and using mvn building my project which is also downloading 0.9.0 version of apache thrift jars. this is the same I am using. – Avinash Jul 31 '13 at 11:56

11 Answers11

71

It usually means that you are using an old version of an interface implementation which is missing a new interface method. For example java.sql.Connection interface got a new getSchema method in 1.7. If you have 1.6 JDBC driver and call Connection.getSchema you will get AbstractMethodError.

Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275
  • 4
    Nice, you had me at "old version of an interface" – mtyson Sep 07 '16 at 20:53
  • Encountered this Exception recently. It's exactly the cause - interface incompatibly between components at runtime. One can refers to the javadoc of the exception for more details. – tuan.dinh May 11 '18 at 07:15
36

The simple answer is this: some code is trying to call a method which is declared abstract. Abstract methods have no body and cannot be executed. Since you have provided so little information I can't really elaborate more on how this can happen since the compiler usually catches this problem - as described here, this means the class must have changed at runtime.

devrobf
  • 6,973
  • 2
  • 32
  • 46
  • Yes, method is defined as abstract, but I traced through the eclipse and I see methods are implemented in child classes – Avinash Jul 31 '13 at 11:56
  • Sure, but that means you have to call a specific child class implementation. You still can't call the method itself. – devrobf Jul 31 '13 at 11:57
  • I checked again , Apache thrift generated code is calling child object specific implementation – Avinash Jul 31 '13 at 12:51
  • Please double-check that. If you are still sure about it, open a JIRA ticket with a complete, reproducible test case. – JensG Jul 31 '13 at 22:43
7

From documnentation of 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.

2

A kind of special case of the above answer.

I had this error, because I was using a spring-boot-starter-parent (e.g. 2.1.0.RELEASE uses spring version: 5.1.2.RELEASE) but I also included a BOM, that also defined some spring dependencies, but in an older version (e.g. 5.0.9.RELEASE).

So one thing to do, is check your dependency tree (in Eclipse e.g. you can use the Dependency Hierarchy) if you are using the same versions.

So one solution could be that you upgrade the spring dependencies in your BOM, another one could be that you exclude them (but depending on the amount, this could be ugly).

morecore
  • 900
  • 3
  • 14
  • 32
2

if you are getting this error on a minified build using Proguard then check if the class is a POJO class and if so then exclude it from the Proguard using the below rule:

-keep class your.application.package.pojo.** {*;}

Deepak PK
  • 59
  • 6
1

If you download any project zip file, after unzipping them and importing into Android Studio, you are unable to run the project because this error happened.

I got out of the problem by deleting my android studio, then download and install the new version.

I truly hope it help.

Thanh Nhật
  • 777
  • 1
  • 7
  • 14
0

If you you are getting this error on the implemented methods, make sure you have added your dependencies correctly as mentioned in this thread.

Community
  • 1
  • 1
amanzoor
  • 389
  • 4
  • 6
0

As Damian quoted :

Normally, this error is caught by the compiler; this error can only occur at run time if [...]

I had the same error that was not caught by the compiler but at runtime. To solve it I only compiled again without giving the code any modification.

yutanpo
  • 28
  • 6
0

I had the same error when I imported an eclipse project into intellij ide.. I tried to import it without .iml file then my problem was solved

0

I get this problem when I update my kotlin plugin to a new version .... the problem is that my pom file is using the older kotlin version .. I guess it might help someone if he is doing this mistake

Deepak Das
  • 177
  • 1
  • 6
0

I am getting various of these and others infrequently on android.. I have to clean everything change som configuration rebuild change configuration again to normal somehow just the build tools don't rebuild everything they should for whatever reason (Android gradle bug obviously).

Renetik
  • 5,887
  • 1
  • 47
  • 66