[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Relying on ClassLoader.getResource results in unexpected beh

flavia.rainone@jboss.com do-not-reply at jboss.com
Thu May 15 09:55:47 EDT 2008


A JBoss AOP user discovered a bug in JBoss AOP when using a class loader he himself defined to load interceptors and intercepted classes:

http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150812#4150812


JBoss AOP Class Pool is not able of finding the generated abstract joinpoint class (the one that is generated to be super class of the generated joinpoint classes).  My theory is that this is happening because AOPClassPool assumes that, if it can find the resource through ClassLoader.getResource method, then the class is available. Since the class loader defined by the user does not overwrite getResource, it will return null, even if it can load the queried class. As a consequence, AOPClassPool.getCached(String) returns null, and ScopedClassPool will try to find the class file by itself. But Javassist also relies on the ClassLoader.getResource and ClassLoader.getResourceAsStream methods (at LoaderClassPath class). So, Javassist also fails to load the class.

I haven't found a Java documentation affirming that we can rely on getResource methods to figure out the class file. If this is the case, is it possible to avoid this situation? If not, we should add at a constraint to the documentation.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151085#4151085

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151085



More information about the jboss-dev-forums mailing list