"I have a feeling that this could be a problem on anything else than jboss."

Works fine on Tomcat. Also, this is a lot like how you'd handle multiple platform versions on Android. Classes and their dependencies are loaded only when the class is actually used, so it should be fine.