My subdeployment is getting ClassCastExceptions in EAP 6

Solution Unverified - Updated -

Issue

  • I can't get JBoss to exclude a Java EE component from my deployment even though I've added an exclusion for it in jboss-deployment-structure.xml.
  • When migrating an application to EAP6 I get ClassCastExceptions for classes provided by JBoss.
  • I have an .ear with a .war subdeployment. I am including my own implementation of something that JBoss already provides (e.g. Hibernate, JAX-WS runtime, Log4J, JAX-RS runtime). I've correctly added exclusions for the component I'm using to jboss-deployment-structure.xml, but I'm still getting ClassCastExceptions. What am I doing wrong? Here is my jboss-deployment-structure.xml (this example shows Log4J):
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
  <deployment>
    <exclusions>
      <module name="org.apache.log4j" />
      <module name="org.jboss.log4j.logmanager" />
    </exclusions>
    ...
  </deployment>
  <sub-deployment name="test.war">
    <exclusions>
      <module name="org.apache.log4j" />
      <module name="org.jboss.log4j.logmanager" />
      ...
    </exclusions>
  ...
  </sub-deployment>
</jboss-deployment-structure>

Environment

  • JBoss Enterprise Application Platform (EAP) 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.