[jboss-user] [JBoss AOP] - Multiple ClassLoaders problem?

fr0w do-not-reply at jboss.com
Wed Jun 4 20:21:06 EDT 2008


Hey,

I'm a developer from DrFTPD, a Java FTP Daemon, and I'm planning to use JBoss AOP in a part of the project.

Our current code depends heavily on JPF (Java Plugin Framework). Quoting from JPF's site: "The plug-in architecture used by Eclipse was taken as the basic model for JPF in early 2004.". This frameworks provides an easy way of adding extensions, creating a complex plugin hierarchy with dependencies, on-the-fly reloading of classes, etc...  But in order to manage all this nice stuff it relies heavilly on its own ClassLoaders (lots are use, creating a complex ClassLoaders graph).

Well, enough of explanations, let's go to the real fun :P

Running an example that is distributed with JBoss AOP 2.0 CR8, I get the following output:


  | DEBUG main org.jboss.aop.instrument.InstrumentorFactory - Passed in instrumentor: null
  | DEBUG main org.jboss.aop.instrument.InstrumentorFactory - Defaulting instrumentor to: org.jboss.aop.instrument.GeneratedAdvisorInstrumentor
  | DEBUG main org.jboss.aop.AdvisorFactory - Passed in advisor: null
  | DEBUG main org.jboss.aop.AdvisorFactory - [debug] Defaulting advisor to: org.jboss.aop.ClassAdvisor
  | DEBUG main org.jboss.aop.Deployment - jboss.aop.class.path is NULL
  | DEBUG main org.jboss.aop.Deployment - jboss.aop.search.classpath: 'null' true
  | DEBUG main org.jboss.aop.Deployment - jboss.aop.path: jboss-aop.xml
  | DEBUG main org.jboss.aop.Deployment - jboss.aop.path[0]: jboss-aop.xml
  | DEBUG main org.jboss.aop.Deployment - deploying file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml
  | DEBUG main org.jboss.aop.AspectXmlLoader - AspectXMLLoader using managerorg.jboss.aop.AspectManager at 126804e
  | DEBUG main org.jboss.aop.instrument.Instrumentor - trying to transform test.Driver
  | DEBUG main org.jboss.aop.instrument.CallerTransformer - There are no caller pointcuts!
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod at 44a4fe33[public static main ([Ljava/lang/String;)V] matches no pointcuts
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod at ab371a54[public teste ()V] matches no pointcuts
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtConstructor at b8c8e6[public Driver ()V] matches no pointcuts
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - test.POJO.var:I matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - test.POJO.var:I matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtConstructor at 281d4b[public POJO ()V] matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.Instrumentor - was test.Driver converted: true
  | DEBUG main org.jboss.aop.SuperClassesFirstWeavingStrategy - cannot compile, isInterface: test.Interface
  | --- new POJO(); ---
  | DEBUG main org.jboss.aop.instrument.Instrumentor - trying to transform test.POJO
  | DEBUG main org.jboss.aop.instrument.CallerTransformer - There are no caller pointcuts!
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod at 6fab46b6[public someMethod ()V] matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtConstructor at 1cd0888[public POJO ()V] matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtConstructor at 1cd0888[public POJO ()V] matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - test.POJO.var:I matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - test.POJO.var:I matches pointcut: all(test.POJO)
  | DEBUG main org.jboss.aop.instrument.Instrumentor - was test.POJO converted: true
  | DEBUG main org.jboss.aop.ClassAdvisor - Creating chains for class test.POJO sun.misc.Launcher$AppClassLoader at 17182c1
  | DEBUG main org.jboss.aop.ClassAdvisor - iterate binding file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml0 all(test.POJO)
  | [debug] method matched binding: public void test.POJO.someMethod()
  | DEBUG main org.jboss.aop.advice.AdviceBinding - added advisor: test.POJO from binding: file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml0
  | DEBUG main org.jboss.aop.advice.AdviceBinding - added advisor: test.POJO from binding: file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml0
  | [debug] field matched read binding: public int test.POJO.var
  | [debug] field matched write binding: public int test.POJO.var
  | DEBUG main org.jboss.aop.advice.AdviceBinding - added advisor: test.POJO from binding: file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml0
  | [debug] constructor matched binding: public test.POJO()
  | DEBUG main org.jboss.aop.advice.AdviceBinding - added advisor: test.POJO from binding: file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml0
  | DEBUG main org.jboss.aop.MethodMatchInfo - populate bindings for public void test.POJO.someMethod() all bindings
  | DEBUG main org.jboss.aop.MethodMatchInfo - 0 test.POJO all(test.POJO) : 1
  | DEBUG main org.jboss.aop.MethodMatchInfo - populate bindings for public void test.POJO.someMethod() actual bindings
  | DEBUG main org.jboss.aop.MethodMatchInfo - 0 test.POJO all(test.POJO) : 1
  | DEBUG main org.jboss.aop.advice.AdviceBinding - added advisor: test.POJO from binding: file:/home/flavio/drftpd/workspace/TestAOP/jboss-aop.xml0
  | DEBUG main org.jboss.aop.instrument.Instrumentor - trying to transform test.SimpleInterceptor
  | DEBUG main org.jboss.aop.instrument.CallerTransformer - There are no caller pointcuts!
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod at 26562bc2[public getName ()Ljava/lang/String;] matches no pointcuts
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod at 2ff3c113[public invoke (Lorg/jboss/aop/joinpoint/Invocation;)Ljava/lang/Object;] matches no pointcuts
  | DEBUG main org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtConstructor at 633e5e[public SimpleInterceptor ()V] matches no pointcuts
  | DEBUG main org.jboss.aop.instrument.Instrumentor - was test.SimpleInterceptor converted: false
  | DEBUG main org.jboss.aop.advice.AspectFactoryWithClassLoaderSupport - Using context classloader sun.misc.Launcher$AppClassLoader at 17182c1 to load aspect test.SimpleInterceptor
  | <<< Entering SimpleInterceptor type: test.JoinPoint_constructor_POJO_0_1$aop
  | empty constructor
  | >>> Leaving SimpleInterceptor
  | --- pojo.someMethod(); ---
  | <<< Entering SimpleInterceptor type: test.JoinPoint_someMethod2315001504750198986_2$aop
  | someMethod
  | >>> Leaving SimpleInterceptor
  | --- pojo.var++; ---
  | <<< Entering SimpleInterceptor type: test.JoinPoint_r_var_3$aop
  | >>> Leaving SimpleInterceptor
  | <<< Entering SimpleInterceptor type: test.JoinPoint_w_var_4$aop
  | >>> Leaving SimpleInterceptor
  | 

In order to run the application I used the following Java Parameters:

  | -Dlog4j.configuration=file:log4j-debug.properties
  | -Djboss.aop.verbose=true
  | -Djboss.aop.path=jboss-aop.xml
  | -javaagent:lib/jboss-aop-jdk50.jar
  | 

So the example works fine, I can see that from the logs.

But when I try to run DrFTPD using the same parameters I used to run the example I only get the following output:


  | [aop-debug] org.jboss.aop.instrument.InstrumentorFactory Passed in instrumentor: null
  | [aop-debug] org.jboss.aop.instrument.InstrumentorFactory Defaulting instrumentor to: org.jboss.aop.instrument.GeneratedAdvisorInstrumentor
  | [aop-debug] org.jboss.aop.AdvisorFactory Passed in advisor: null
  | [aop-debug] org.jboss.aop.AdvisorFactory [debug] Defaulting advisor to: org.jboss.aop.ClassAdvisor
  | [aop-debug] org.jboss.aop.Deployment jboss.aop.class.path is NULL
  | [aop-debug] org.jboss.aop.Deployment jboss.aop.search.classpath: 'null' true
  | [aop-debug] org.jboss.aop.Deployment jboss.aop.path: conf/aop
  | [aop-debug] org.jboss.aop.Deployment jboss.aop.path[0]: conf/aop
  | [aop-debug] org.jboss.aop.Deployment deploying file:/home/flavio/drftpd/trunk/conf/aop/lucene-aop.xml
  | [aop-debug] org.jboss.aop.AspectXmlLoader AspectXMLLoader using managerorg.jboss.aop.AspectManager at 503429
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.java.plugin.boot.ApplicationInitializer
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.java.plugin.boot.SplashHandler
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.java.plugin.boot.BootErrorHandler
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.java.plugin.boot.PluginsCollector
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy warning, isFrozen: org.apache.log4j.Category [class path: sun.misc.Launcher$AppClassLoader at 17182c1:] - dcl sun.misc.Launcher$AppClassLoader at 17182c1
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.log4j.spi.AppenderAttachable
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.commons.logging.Log
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.log4j.spi.LoggerRepository
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.log4j.spi.RepositorySelector
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.log4j.spi.RendererSupport
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.log4j.spi.LoggerFactory
  | [aop-debug] org.jboss.aop.SuperClassesFirstWeavingStrategy cannot compile, isInterface: org.apache.log4j.or.ObjectRenderer
  | 

That's not all the output, but the rest is pretty much the same.

Java Parameters:

  | -Dlog4j.configuration=file:conf/log4j-debug-nojpf.properties
  | -Djpf.boot.config=conf/boot-master.properties
  | -Djava.library.path=lib
  | -Djboss.aop.verbose=true
  | -Djboss.aop.path=conf/aop
  | -javaagent:lib/aop/jboss-aop-jdk50.jar
  | 

And the jboss-aop.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | <aop>
  | 
  |    <bind pointcut="all(org.drftpd.vfs.index.lucene.LuceneEngine)">
  |        <interceptor class="org.drftpd.vfs.index.lucene.SimpleInterceptor"/>
  |    </bind>
  | 
  | </aop>
  | 

As you can notice, the output is veery diferent when running the example (lots of lines saying that JBoss AOP found a pointcut match and all that suff) from when running DrFTPD, so I bet I'm making some kind of mistake or JPF and JBoss AOP cannot co-exist or something like this.

I'm willing to provide anymore info you need in order to trace my problem.

Thanks in advance,

Flavio 'fr0w' Costa 

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

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



More information about the jboss-user mailing list