我想用一个库方法来调用我的Class中的一个javassist代理。Javassist java.lang.NoClassDefFoundError
可以说我有一个类:
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()");
然后它给出一个没有这样的类发现异常。
我通过在清单文件中添加jars路径解决了这个问题 –