2 Replies Latest reply on Mar 2, 2011 9:16 PM by 802418

    Running two copies of an applet causes classloader issues

      If I run two copies of my applet in a browser, I get class cast exceptions of the form: Class A cannot be cast to Class A. The class in question is an enum and the error occurs in a static method. And the enum instance is stored in a (final) static variable.

      I'm assuming each applet has it's own class loader instance and that an instance from one class loader is being interpreted by the other loader. (Interestingly, it's the first-loaded of the two applet instances that fails. The second-loaded works fine.)

      I thought that static variables are specific to class loaders. So I don't understand how they're getting confused. Can anyone explain this and suggest how to get around it?