Dom4j class loading bug

Here are some facts:

  * The model was created using the class-loader in root context -- it uses dom4j.
  * A few of the servlets are in the app context -- these do not use dom4j.
  * If the first app that is run has a dom4j jar in the app context, then no apps will ever work properly.
  * Only a single instance of BRJS is being shared between all apps.
  * The web requests that lead to the problem are handled by a servlet that is in the app context, then forwarded to model code created in the root context, which then finally leads to DOM4J being used, and therefore loaded.

This seems to suggest that the class-loader used to load new classes is not the class-loader that was used to load the object instance that caused the need for this new class, even though this is what I've read and been taught. In the meantime, since I can't find any good resources on this, and am not sure how to debug this further, I've fixed the problem by switching from 'dom4j' to the built-in XML parser instead, which solves our immediate problems, but may lead to further problems down the line.