title: Jboss 5, classloader and multiple class instances
body: <p>I had a problem with my application. To resume the problem, I had to do migrate an application from jboss 4 to jboss 5.</p>
  
  <p>During the war deployement, I had this error:</p>
  
  <pre><code>java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME"
  the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the referring class,
  javax/xml/datatype/DatatypeConstants, and the class loader (instance of &lt;bootloader&gt;)
  for the field's resolved type, javax/xml/namespace/QName,
  have different Class objects for that type
  </code></pre>
  
  <p>After many searchs, I found this error was here because I had several time the same class in differents packages. Once in a dependency package (from my pom.xml) and once provided by jboss.</p>
  
  <p>So, to resolve this problem, I have give a scope "provided" for my dependency.</p>
  
  <p>But I don't understand why this solution works. I thought it works to have several time the same class in an application. I know it's not a good thing, but with jboss 4, it's work.</p>
  
  <p>Someone can explain me why it works with jboss 4 and not with jboss 5.</p>
  
  <p>Thanks for your explanation :)</p>