I can't speak to the underlying problem, but the "cannot cast" error message, while a bit startling at first glance, is actually giving a bit of information. How can an object of a class not be cast to that class? If the same class definition was loaded by different class loaders. Java considers those to be two completely different class definitions.
Probably the object the code is trying to cast is derived from the class as loaded by one class loader, while a different class loader (I'm not sure whether it's the current thread's context class loader or the class loader that loaded the currently-running class) provides the class to which the code is trying to do the cast.
MyClass myObj = (MyClass) otherObj;
I suspect that otherObj was instantiated using a definition of MyClass loaded by some other class loader so that the cast to [i]this [/i]code's class loader's MyClass definition fails.
That may help a little.
- Tim
[Message sent by forum member 'tjquinn' (tjquinn)]
http://forums.java.net/jive/thread.jspa?messageID=216374