0 Replies Latest reply on Sep 20, 2005 7:54 PM by yonasj

    Difficulties running javassist from an ant-task

    yonasj

      Hi,

      I am using javassist from within an ant task. I had quite a bit of difficulty.

      I posted this as a bug to ant, but they are having difficulty grocking the issue, as am I.


      http://issues.apache.org/bugzilla/show_bug.cgi?id=36717

      The bug is best illustraighted by the following code snippet (from execute
      within my ant task):

      System.out.println("CL1: "+Thread.currentThread().getContextClassLoader());
      System.out.println("CL2: "+this.getClass().getClassLoader());
      

      The output is:

      CL1: java.net.URLClassLoader@82ba41
      CL2: org.apache.tools.ant.loader.AntClassLoader2@1c1ea29
      


      The workaround for my code is:

      Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());


      Which causes Javassist to work perfectly.

      Yonas.