I have an application, where I load jarfiles at runtime. I use URLClassloader to remember the loaded files, to be able to load the complete content of the jarfiles.
All that works fine for most cases ...
but now I get this strange error (see screenshot), with the trace:
The referred code line from StdSkinImage:68 is:
a superclass of StdSkinImage implements ChildEntity<de.schwarzrot.dvd.theme.standard.StdTheme>, which has a access-method
with T being de.schwarzrot.dvd.theme.standard.StdTheme
StdTheme is already instantiated, cause it acts as factory for StdSkinImage.
I guess, that the getParent() causes the problem, but I don't know, how I can track that error down.
When I load the sources in eclipse, no error occurrs. It happens only when I call the application standalone.
Sure, the loading of the jarfile happens in a different thread, but both threads have the right classloader (that contains the jar-urls).
This is (as you probably already suspect) the kind of error you get when you manage to load a class twice using two different classloaders. This can happen because you've got more than one user-defined classloader, or it can happen if your user-defined classloader doesn't properly delegate to the system class loader. Checking getClass().getClassLoader() on the object you're trying to cast and comparing it with calling the same methods for other objects (or comparing it to references of the actual classloaders you've created, or checking for null, which can represent the system classloader) may help you track down the problem.
thank you very much for your attention and support!
I have to confess, I did not suspect the double class loading - I did not ever thought, that it is possible.
So thanks, I gonna look into that direction.
My application starts from a jarfile too, so is it ok, if I set the original classloader as parent of the created URLClassLoader and can I use that URLClassLoader in any thread, or do I have to care about the threads classloader every time?
author and iconoclast