Today, I met a java.lang.NoSuchMethodException anomaly. The basic solution is:
1. Check if the correct version of the jar package is in the same class.
2. Check if there are jar package conflicts, such as multiple versions of Xxx.jar loaded.
If MAVEN works, you can display the project's dependency tree through MVN dependency:tree.
3. If you are unable to locate, you can find out which jar package the actual loaded class belongs to in the following ways.
1 class<?> clazz = Class.forName ("Com.xxx.xxx.XXX"); # class name 2 codesource cs = Clazz.getprotectiondomain (). Getcodesource (); 3 String location = cs.getlocation (). GetPath (); 4
The above code does not take exception handling, add it yourself.
The above method is used to determine whether the actual loaded class meets the expectations and then does the processing.
How to troubleshoot Java.lang.NoSuchMethodError errors