开发者

AspectJ load-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 开发者_StackOverflowwith 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 (i.e. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜