简体   繁体   中英

Why I am getting java.lang.AbstractMethodError errors?

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)

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.

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.

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.

A kind of special case of the above answer .

I had this error, because I was using a spring-boot-starter-parent (eg 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 (eg 5.0.9.RELEASE ).

So one thing to do, is check your dependency tree (in Eclipse eg 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).

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.

如果您在已实现的方法上遇到此错误,请确保您已按照此线程中的说明正确添加了依赖项。

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.

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.** {*;}

当我将 Eclipse 项目导入 intellij ide 时,我遇到了同样的错误。我尝试在没有 .iml 文件的情况下导入它,然后我的问题解决了

当我将我的 kotlin 插件更新到新版本时出现此问题....问题是我的 pom 文件使用的是较旧的 kotlin 版本..我想如果他犯了这个错误可能会对某人有所帮助

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM