2 Replies Latest reply on Apr 7, 2017 2:14 PM by marks1900

    Wildfly classpath library conflicts - jboss-deployment-structure.xml

    marks1900 Newbie

      I have a war that acts as a bridge between my web application and Druid ( http://druid.io/ ), where I have one message driven bean (@MessageDriven) that reads from a queue and sends requests to Druid using a library called Tranquility (https://github.com/druid-io/tranquility ).  Unfortunately, the Druid Tranquility Maven dependency tree is large and has multiple library conflicts with the Wildfly classpath.  I have in the past cherry picked which Wildfly dependencies to exclude from the classpath using jboss-deployment-structure.xml.  However I am wondering if the following jboss-deployment-structure.xml template might be a better approach, where instead I choose what Wildfly libraries to include in the classpath (Using http://developer-should-know.com/post/109875086957/how-to-exclude-jboss-or-wildfly-subsystems-and  for inspiration).  Thoughts?

       

      Proposed - Sample jboss-deployment-structure.xml

       

      <?xml version='1.0' encoding='UTF-8'?>
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
          <deployment>
              <exclusions>
                  <!-- Core Server  -->
                  <module name="javax.api" />
                  <module name="sun.jdk" />
                  <module name="org.jboss.vfs" />
                  <!-- Batch Subsystem  -->
                  <module name="javax.batch.api" />
                  <!-- EE Subsystem  -->
                  <module name="javaee.api" />
                  <!-- EJB3 subsystem  -->
                  <module name="javaee.api" />
                  <!-- JAX-RS (Resteasy) subsystem  -->
                  <module name="javax.xml.bind.api" />
                  <module name="org.jboss.resteasy.resteasy-atom-provider" />
                  <module name="org.jboss.resteasy.resteasy-cdi" />
                  <module name="org.jboss.resteasy.resteasy-jaxrs" />
                  <module name="org.jboss.resteasy.resteasy-jaxb-provider" />
                  <module name="org.jboss.resteasy.resteasy-jackson-provider" />
                  <module name="org.jboss.resteasy.resteasy-jsapi" />
                  <module name="org.jboss.resteasy.resteasy-multipart-provider" />
                  <module name="org.jboss.resteasy.async-http-servlet-30" />
                  <!-- JCA subsystem  -->
                  <module name="javax.resource.api" />
                  <module name="javax.jms.api" />
                  <module name="javax.validation.api" />
                  <module name="org.jboss.logging" />
                  <module name="org.jboss.ironjacamar.api" />
                  <module name="org.jboss.ironjacamar.impl" />
                  <module name="org.hibernate.validator" />
                  <!-- JPA (Hibernate) subsystem  -->
                  <module name="javax.persistence.api" />
                  <module name="javaee.api" />
                  <module name="org.jboss.as.jpa" />
                  <module name="org.hibernate" />
                  <!-- Logging Subsystem -->
                  <module name="org.jboss.logging" />
                  <module name="org.apache.commons.logging" />
                  <module name="org.apache.log4j" />
                  <module name="org.slf4j" />
                  <module name="org.jboss.logging.jul-to-slf4j-stub" />
                  <!-- SAR Subsystem -->
                  <module name="org.jboss.logging" />
                  <module name="org.jboss.modules" />
                  <!-- Security Subsystem -->
                  <module name="org.picketbox" />
                  <!-- Web Subsystem -->
                  <module name="javaee.api" />
                  <module name="com.sun.jsf-impl" />
                  <module name="org.hibernate.validator" />
                  <module name="org.jboss.as.web" />
                  <module name="org.jboss.logging" />
                  <!-- Web Services Subsystem  -->
                  <module name="org.jboss.ws.api" />
                  <module name="org.jboss.ws.spi" />
                  <!-- Weld (CDI) Subsystem -->
                  <module name="javax.persistence.api" />
                  <module name="javaee.api" />
                  <module name="org.javassist" />
                  <module name="org.jboss.interceptor" />
                  <module name="org.jboss.as.weld" />
                  <module name="org.jboss.logging" />
                  <module name="org.jboss.weld.core" />
                  <module name="org.jboss.weld.api" />
                  <module name="org.jboss.weld.spi" />
              </exclusions>
              <dependencies>
                  <!-- Logging Subsystem -->
                  <module name="org.jboss.logging" />
                  <module name="org.apache.commons.logging" />
                  <module name="org.apache.log4j" />
                  <module name="org.slf4j" />
                  <module name="org.jboss.logging.jul-to-slf4j-stub" />
                  <!-- Web Subsystem -->
                  <module name="javaee.api" />
                  <module name="com.sun.jsf-impl" />
                  <module name="org.hibernate.validator" />
                  <module name="org.jboss.as.web" />
                  <module name="org.jboss.logging" />
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
         
      

       

      Verses - Explicitly cherry picking my exclusions, and hoping I don't discover a new one at run time.

       

      <?xml version='1.0' encoding='UTF-8'?>
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
          <deployment>
              <exclusions>
                  <module name="com.fasterxml.jackson.core.jackson-annotations" />
                  <module name="com.fasterxml.jackson.core.jackson-core" />
                  <module name="com.fasterxml.jackson.core.jackson-databind" />
                  <module name="org.jboss.resteasy.resteasy-jackson2-provider" />
                  <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
              </exclusions>
              <dependencies>
                  <module name="org.slf4j" />
              </dependencies
          </deployment>
      </jboss-deployment-structure>
      
        • 1. Re: Wildfly classpath library conflicts - jboss-deployment-structure.xml
          Tomaz Cerar Master

          well looking at your first example it is ridiculous.

           

          you first exclude modules, and that include same modules.

           

          Anyhow, I think you might want something else.

          you want to exclude subsystems to do anything to your deployment.

           

          so you should add

          <exclude-subsystems>

                  <subsystem name="resteasy" />

          ...

          ...

          ...

              </exclude-subsystems>

           

          to exclude subsystems from even processing your deployment.

          Also keep in mind that not all subsystems come to play for your deployment.

          they only activate if some special markers are found, for example sar subsystem will only activate if your deployment is named .sar

          or batch only when batch deployment descriptors are found.

           

          web subsystem will never run, as it doesn't exist in wildfly anymore, it was replaced by undertow subsystem.

          • 2. Re: Wildfly classpath library conflicts - jboss-deployment-structure.xml
            marks1900 Newbie

            The example I gave above is definitely verbose.  However, if I wanted a clean slate, to exclude all dependencies before specifically choosing which ones to add, what would be the best way to achieve this?

             

            It my understanding that the implicit dependencies are listed here - https://docs.jboss.org/author/display/WFLY10/Implicit+module+dependencies+for+deployments .  Is there a resource that lists all the subsystems?

             

            Found this (https://docs.jboss.org/author/display/WFLY10/Subsystem+configuration ) but it doesn't really mention it.  Running a manual grep for '<subsystem.*>' gives the following, yet I don't even see a match for the "resteasy" subsystem.

             

            wildfly-10.1.0.Final$ grep --no-filename --only-matching -r -e '<subsystem.*>' . | sort | uniq
            <subsystem xmlns="urn:jboss:domain:batch-jberet:1.0">
            <subsystem xmlns="urn:jboss:domain:bean-validation:1.0" />
            <subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/>
            <subsystem xmlns="urn:jboss:domain:datasources:2.0">
            <subsystem xmlns="urn:jboss:domain:datasources:4.0">
            <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
            <subsystem xmlns="urn:jboss:domain:ee:2.0">
            <subsystem xmlns="urn:jboss:domain:ee:4.0">
            <subsystem xmlns="urn:jboss:domain:ejb3:3.0"/>
            <subsystem xmlns="urn:jboss:domain:ejb3:4.0">
            <subsystem xmlns="urn:jboss:domain:iiop-openjdk:1.0">
            <subsystem xmlns="urn:jboss:domain:iiop-openjdk:1.0"/>
            <subsystem xmlns="urn:jboss:domain:infinispan:4.0">
            <subsystem xmlns="urn:jboss:domain:io:1.1">
            <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
            <subsystem xmlns="urn:jboss:domain:jca:2.0">
            <subsystem xmlns="urn:jboss:domain:jca:4.0">
            <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
            <subsystem xmlns="urn:jboss:domain:jgroups:4.0">
            <subsystem xmlns="urn:jboss:domain:jmx:1.3">
            <subsystem xmlns="urn:jboss:domain:jpa:1.1">
            <subsystem xmlns="urn:jboss:domain:jsf:1.0"/>
            <subsystem xmlns="urn:jboss:domain:jsr77:1.0"/>
            <subsystem xmlns="urn:jboss:domain:logging:3.0">
            <subsystem xmlns="urn:jboss:domain:mail:2.0">
            <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
            <subsystem xmlns="urn:jboss:domain:modcluster:2.0">
            <subsystem xmlns="urn:jboss:domain:naming:2.0">
            <subsystem xmlns="urn:jboss:domain:naming:2.0"/>
            <subsystem xmlns="urn:jboss:domain:picketlink-federation:2.0">
            <subsystem xmlns="urn:jboss:domain:picketlink-identity-management:2.0">
            <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
            <subsystem xmlns="urn:jboss:domain:remoting:3.0">
            <subsystem xmlns="urn:jboss:domain:request-controller:1.0"/>
            <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
            <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0"/>
            <subsystem xmlns="urn:jboss:domain:rts:1.0">
            <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
            <subsystem xmlns="urn:jboss:domain:security:1.2">
            <subsystem xmlns="urn:jboss:domain:security-manager:1.0">
            <subsystem xmlns="urn:jboss:domain:singleton:1.0">
            <subsystem xmlns="urn:jboss:domain:transactions:2.0">
            <subsystem xmlns="urn:jboss:domain:transactions:3.0">
            <subsystem xmlns="urn:jboss:domain:undertow:3.1">
            <subsystem xmlns="urn:jboss:domain:webservices:1.2">
            <subsystem xmlns="urn:jboss:domain:webservices:2.0">
            <subsystem xmlns="urn:jboss:domain:weld:3.0"/>
            <subsystem xmlns="urn:jboss:domain:xts:2.0">