动态加载jar在getMethod时即不报错也没有返回
String filePath = "test.jar";
File file = new File(filePath);
URL url = file.toURI().toURL();
URLClassLoader loader = new URLClassLoader(new URL[]{url});
String className = "com.my.test";
Class<?> processorClass = loader.loadClass(className);
Object obj = processorClass.newInstance();
method = processorClass.getMethod("getData", String.class, BodyBuf.class)
method.invoke(obj, "12345", buf);
当执行到 processorClass.getMethod 时就停止了,即没有返回,也没有异常。
test.jar 是外部包,也是mvn打包,在开发环境测试正常调用,使用mvn 打包后在运行环境根据日志出现以上现象。