4 Replies Latest reply on Mar 10, 2017 9:16 PM by john.ho.sv

    Is it possible to make a dynamic module have a higher class loader precedence over a static one?

    john.ho.sv

      "WildFly 10.1.0.Final" includes "Netty 4.0.33.Final". But I want to use the latest "Netty 4.1.8.Final" in one of the war files while keeping the static module "Netty to 4.0.33.Final" for the rest of the war files.

       

      On the WildFly server in my Eclipse env, there are three war files under the ${WILDFLY_HOME}/standalone/deployments: a1.war, a2.war, and a3.war.

      The netty-all-4.1.8.Final.jar is put under ${WILDFLY_HOME}/standalone/deployments/a1.war/WEB-INF/lib.

      The jboss-deployment-structure.xml is put under ${WILDFLY_HOME}/standalone/deployments/a1.war/WEB-INF.

       

      I have tried different versions of the jboss-deployment-structure.xml file (below is a simple one)

       

      <jboss-deployment-structure>

        <deployment>

          <dependencies>

            <module name="deployment.netty" />

          </dependencies>

        </deployment>

      </jboss-deployment-structure>

       

      But I got the following error message:

      18:20:30,300 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "a1.war")]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [

          "jboss.module.resolve.phase.\"deployment.a1.war.war\".main.1 is missing [jboss.module.spec.service.\"deployment.netty\".main]",

          "jboss.module.service.\"deployment.a1.war\".main is missing [jboss.module.spec.service.\"deployment.netty\".main, module.resolved.service.\"deployment.a1.war\".main]"

      ]}

       

      Obviously, the dynamic module is not set properly. I tried adding "slot" but no luck. What's missing?

       

      I tried adding the jar as a resource (partial jboss-deployment-structure.xml below). It seemed the dynamic jar was loaded but the static module netty-4.0.32.Final.jar had a higher class loader precedence. I got an error "

      java.lang.NoSuchMethodError: io.netty.util.internal.PlatformDependent.getByte([BI)B" for the io.netty.util.AsciiString.byteAt(byte[], int) call which doesn't exist in netty-4.0 but in netty-4.1.

       

          <resources>

            <resource-root path="WEB-INF/lib/netty-all-4.1.8.Final.jar" />

          </resources>

       

      I have a more important question. Is it possible to make a dynamic module ("netty-all-4.1.8.Final.jar") have a higher class loader precedence over a static one (netty-all-4.0.32.Final.jar)?

       

      I appreciate any comments/feedback.