1 Reply Latest reply on Aug 12, 2003 4:32 AM by chiba

    ClassCastException

    popmace

      Hi,
      I created an object o using javassist. The object implements an existing interface I.
      Now when I tried {I i=(I)o } ie to cast the object into the interface it is throwing ClassCastException
      What might be wrong ?
      If it is not possible how to I use the objects created using javassist.

      Thank you
      Popmace

        • 1. Re: ClassCastException
          chiba

          Using the reflection API is an easier way to call a
          method in the class you dynamically define. This is
          not the limitation by Javassist but the Java
          language.

          Otherwise, you should carefully control your class
          loader that will load the class A so that it would
          delegate loading the interface I to the parent class
          loader.

          Using a class loader is really difficult. It might be
          better to carefully read Section 4 of the Javassist
          tutorial before writing a program.