How to Solve Nosuchmethoderror Error

1. reason
this error may be triggered when the project dependency is complex, there is a problem with the Java running environment, or there are different versions of the same type of jar package. In essence, the JVM cannot find a specific method of a class, that is, the JVM loads the wrong version of the class. To put it bluntly, the JVM can’t find the method it really wants to call! There are two main situations in which this error occurs:

Imported mismatched package version
the development environment is inconsistent with the running environment

2. solutions
check “external libraries” to see whether the error reporting method exists. If it does not exist, there must be a problem with the package. Just update the package; If it exists, it indicates that the package has been successfully introduced, but the integrated development environment may not be synchronized to. You can try to force the update. In addition, you can check whether the development environment is consistent with the running environment. If not, modify it.

3. special reminder
in case of Maven project, there are two main methods in the process of updating the package:

Go to the local Maven warehouse, delete the corresponding package, and then click refresh in “Maven project”
directly enter the command in the command line of “Maven project” to force the update
among them, method 1 is not reliable, and the operation may not be successful. The reason is unknown. Method 2 is strongly recommended. Nothing else, reliable!

Read More: