time weaving for signed jars

Does anybody success in using AspectJ load-time weaving with signed jars?

I got an exception and have no idea how to fix it (tested with AspectJ 1.6.8-16.10):

Exception in thread "main" java.lang.NoClassDefFoundError: com/package/clazz$AjcClosure1
    at com.package.test.main(test.java:55)
Caused by: java.lang.ClassNotFoundException: com.package.clazz$AjcClosure1
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 1 more

Frankly speaking I event not sure if it's technically possible, but I know that similar issue (using dynamically generated java code from signed java classes) was done for Hibernate project (ie using Javassist instead of CGLIB). Details are here.


The simular problem is described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=328099 and fixed in AspectJ 1.6.12. AspectJ sometimes generates closure classes during weaving and these must be defined with the same protection domain as the jar that gave rise to them. In 1.6.12.M1 this should now work correctly.

链接地址: http://www.djcxy.com/p/3428.html

上一篇: 如何在WPF ViewModel中使用模型验证规则

下一篇: 为有签名的罐子编织时间