检测javassistjava。lang.NoClassDefFoundError
我想插入一个库方法来调用javassist代理中的一个类
假设我有一门课:
Class A {
void display() {
System.out.println("Inside A.dipslay()");
}
}
然后当我调用:
method.insertAfter("packageName.A.display()");
它抛出异常:
Exception in thread "main" java.lang.NoClassDefFoundError: packageName/A
at java.net.HttpURLConnection.setRequestMethod(libraryClass)
at sun.net.www.protocol.http.HttpURLConnection.setRequestMethod(libraryClass)
at com.avekshaa.app.SecurityFilter.sendGet(Class where i call the Library Class)
at com.avekshaa.app.SecurityFilter.main(Class where i call the Library Class)
当我直呼其名时:
method.insertAfter("A.display()");
然后它给出了一个未发现此类异常的类
# 1 楼答案
我通过在javassist清单文件中添加jars路径解决了这个问题。 Reffer-this