Yes, this is an expected behaviour. JBoss uses a Unified Classloader approach where all the classes are stored in a flat directory package irrespective of their individual deployment units. If you have multiple versions of the same class, scope each ear file by adding a jboss-app.xml
with these entries in it.
<jboss-app> <loader-repository>:loader=myfile.ear</loader-repository> </jboss-app>
See more info in the Admindevel guide(paid docs) for Scoping.
Adding the jboss-app.xml to the ear file does the trick.
But what if I want to scope several subpackages in the
ear file. I have looked into the jboss-app dtd and only
one loader-repository element can be used.
Also have another question. What are the module elements for ?
The loader-repository tag can be used with every deployment in your jboss specific deployment descriptor like jboss.xml, jboss-web.xml or jboss-app.xml .
Don't ask me about the module tag. All I know is mentioned in the dtd ;-)