1 Reply Latest reply on Sep 9, 2004 10:42 AM by chiba

    Problem using LoaderClassPath  in 3.0Beta2

    tfrank

      I have been trying to use Javassist and am having problems trying to use ClassPool.get() for a class that will be loaded by my own ClassLoader. It fails with the NotFoundException indicating the class could not be loaded. I know the MyInterface Class is loadable via my classloader as I can use my classloader directly to load the class.
      The code is as follows:

       cPool = ClassPool.getDefault();
       java.lang.ClassLoader cll = this.getClass().getClassLoader();
       cPool.appendClassPath( new LoaderClassPath( cll ) );
       serializableClass = cPool.get( "java.io.Serializable" );
       CtClass iClass = cPool.get( "myPackage.MyInterface" );
      


      I have tried the above code in the Javassist 2.6 version and it does work, but will not work in the 3.0Beta2 version. Are there any known issues in this area of the 3.0Beta2 code?

      Also is there a projected "release dates" for the 3.0 code? I'm still trying to decide if I should use the 2.6 or the 3.0 code at this point.

        • 1. Re: Problem using LoaderClassPath  in 3.0Beta2
          chiba

          A difference between 2.6 and 3.0beta is that ClassPool#get() in 3.0beta
          calls ClassLoader#getResource() although 2.6 calls
          ClassLoader#getResourceAsStream().

          If you use 3.0beta, your ClassLoader must define both getResource()
          and getResourceAsStream().

          I'll put this info into javadoc.

          As for release schedule, 3.0RC1 will be released by this weekend.
          I recommend 3.0RC1, which will be fully compatible to 3.0.