Problem description
This exception occurs when a specified function cannot be found. The library version that is depended on in compilation contains the function, but the function is not found during runtime. This exception is usually caused by reflection invocations.
Solution
This exception occurs when a specified function cannot be found. Check the class library version information in the package. This exception is usually caused by reflection invocations. Check the log entries near the crash log entry and check whether the function name is correct in the code involved in the crash log entry.
Sample code
package com.alibaba.mqc.test;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
// Simple reflection invocation demo
public class V {
public void printf(){
System.out.println("printf");
}
public static void main(String[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException {
Class c = Class.forName("com.alibaba.mqc.test.V");
Method m = c.getDeclaredMethod("printf",null);
m.invoke(c.newInstance(),null);
}
}