We think we have found a design flaw in the UnifiedClassLoader architecture for JBoss 3.0 and would like confirmation (and hopefully a fix or workaround!).
The bug surfaces when multiple deployment units in an EAR are trying to share classes via the UnifiedClassLoader mechanism (through Class-Path: entries in the deployment units' MANIEFST.MF files).
Each unit gets it's own UnifiedClassLoader instnace, but each instance points to the same repository. Consider the use of package private members in this case. Class A and B are in the same package, but A has package private members used by B. A will be loaded and used by UCL(EJB). B is loaded and used by UCL(WAR). When B tries to call A's package private members (which is normally allows), java throws an IllegalAccessError since A and B came from different classloaders. This check appears to be done in the native java code. It doesn't care that they came from the same repository, just that they didn't come from the same ClassLoader instance.
Can someone confirm this and/or suggest a workaround?
Maybe the UnifiedClassLoader could be a singleton, and could intelligently multiplex Class-Paths depending on who the subclass is?