hi everybody im writing a classloader that loads the classbytes from a DB. when i instantiate classes using this classloader, then i get java.lang.ClassCastException. here is what i do: i overwrite the findClass method to load bytes from DB, then call defineClass and return this class. the bytes i retrieve from DB are correct (same as class file in file system) is there anything else im supposed to do ? what is definePackage for ? what are all the parameters in definePackage ? thanks k
IMHO, whatever you have done is just fine. I don't think you need to be bothered about other methods in java.lang.ClassLoader. did you try printing out the class name after loading it? classObj.getName() --> what does it print? has this class been already loaded by some other class loader(the System class loader?) before And you are trying to load it again using your custom class loader. The cast then tends to fail in such cases. It w'd be nice if you could elaborate the problem a bit. We c'd all learn from it!