2 Replies Latest reply on May 17, 2011 3:49 PM by deanhiller

    anyway to do loadtime aop without javaagent?

    deanhiller

      We are using annovention to scan for annotations which means our Class is not loaded since it just reads the bytecode.  I then have a list of all the classes I want to insert two methods into(readObject/writeObject) and add the Serializable interface too(very special platform targeted at specific problem). 

       

      Soooo, now that I have the classname and it is NOT in the classloader, I would really like to load the class now without any tweaks to the command line so all the unit tests keep working without developers having to change their config for every test case.  Ideally, we don't want compile time weaving since developers run the unit tests from eclipse as well.

       

      I am assuming, I could setup a classloader and that hopefully jbossAOP already has a classloader I can just wire in and maybe feed this special list of classes into that classloader as I discover them???

       

      thanks for any help/pointers to more docs on this. 

      Dean

        • 1. anyway to do loadtime aop without javaagent?
          earnest.dyke

          Is there a reason your pointcut can't look for annotations and apply your changes only to those classes?

           

          Earnie!

          • 2. anyway to do loadtime aop without javaagent?
            deanhiller

            From the AOP docs, there was compile time, load time(and then hotswap as well).  didn't want compile time, load time required a change to command line.

             

            I figured out how to do it myself with javassist and on bootup I just define the class files before someone loads the class in for the first time thanks to the fact that annovention scans annotations without loading classes(that rocks) and thanks to javasssist reading in bytecode without loading the class files and then I modify the class and inject it into the classloader...works great now!!!

             

            I wish I could have done that with jbossAOP but there was no docs on how to load the new class into the classloader.