0 Replies Latest reply on Feb 13, 2012 5:14 PM by jacklund

    How do I specify a ClassFileTransformer for a War file contained within an Ear deployment?

    jacklund

      I'm trying to set up a class file transformer for an Ear deployment. I'm using the following as my jboss-deployment-structure.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
          <deployment>
              <transformers>
                  <transformer class="com.foo.MyClassFileTransformer" />
              </transformers>
          </deployment>
      </jboss-deployment-structure>
      

       

      Within my Ear file I have a War file and an EJB-jar file. The jboss-deployment-structure.xml file is in the META-INF directory of the Ear file. If I deploy the Ear file, I see the classes in the EJB-jar being transformed, but none of the classes in the War file are being sent to the transformer. However, if I deploy just the War file, and put the jboss-deployment-structure.xml in WEB-INF/classes/META-INF in the War file, I see the War classes being transformed.

       

      My suspicion is that the jboss-deployment-structure.xml is only being applied to the Ear-level module class loader, which is being used by the EJB jar file, but the War file has a separate class loader, so my transformer isn't being used.

       

      I've tried including the jboss-deployment-structure.xml in both the Ear and War files, but then I get the following message in the log:

       

      /path/to/MyEar.ear/MyWar.war/WEB-INF/jboss-deployment-structure.xml in subdeployment ignored. jboss-deployment-structure.xml is only parsed for top level deployments.

       

      Is there any way to specify a ClassFileTransformer globally for an Ear deployment such that it will be applied to all subdeployments (Wars, EJB-jars, etc)?