Spring boot application uses inversion of control to load all the dependency classes. Java supports the backward compatibility. If any issue occurred due to compatibility, the exception “java.lang.AbstractMethodError” will be thrown. In this post, the issue of java.lang.AbstractMethodError will be discussed

Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.AbstractMethodError: org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/Class;)Z
        at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:79)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:282)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:214)

Root Cause

This problem occurs when some software is updated. If spring boot is upgraded to higher version and mismatch upon class files and jar files compatibility, throws this exception. This issue occurs either at the start of the spring boot or when the dependency class is invoked.

For example

create a spring boot application (say “my application 1.0.0”), dependency jar (api.1.0.0.jar), implemented class jar (impl.1.0.0.jar) in java 1.7.

Now you upgrade the spring boot application (say “my application 1.1.0”), dependency jar (api 1.0.0.jar) and java 1.8.the implemented jar for java 1.8 is (impl.1.1.0.jar).

Now if you assign a class from impl1.1.0.jar to a abstract class in api.1.0.0.jar. Now try to access abstract method that return a dynamically created class from java 1.8 which is not compatible with java 1.7 compiled interface / class then this error occurs..

How to reproduce this issue

create dependency jar (api.1.0.0.jar), implemented class jar (impl.1.0.0.jar) in java 1.7. Upgrade dependency jar (api.1.1.0.jar), implemented class jar (impl.1.1.0.jar) in java 1.8

Create a spring boot project in java 1.7 with dependency jar (api.1.0.0.jar) and implemented class jar (impl.1.1.0.jar)

Solution 1

check all the dependency jars versions and compatibility java version. if any mismatch, tries to upgrade, downgrade, exclude or include the dependency jar version that matches the correct java version


If the issue is due to hibernate loading issue, then tries to downgrade hibernate version say 4.0.0. and try to start spring boot application.

Solution 2

Open your pom.xml in Spring Tool Suite editor, check and compare the dependency jars versions in Dependencies tab and Dependency Hierarchy tab before and after the spring boot application. fix the dependency issue if any change in third party jars version.

Leave a Reply