5 Replies Latest reply on Apr 12, 2012 5:12 AM by Piotr Zielniok

    The library I use needs original log4j but at the same time I want to use JBoss logging infrastructure

    Piotr Zielniok Newbie

      I have an ear (deployment) with few webapps and ejbs inside (subdeployments). All subdeployments use the library that is based on original log4j (uses its internal API) - lets call it lblog4j.jar

      I need to allow the library to use original log4j.jar and at the same time I would like my subdeplyments to use JBoss logging infrastructure.


      My first idea was to create custom module in jboss dependency structure file containing the library and the original log4 jar:



      <module name="deployment.lblog4j" >


              <include path="com/xxx/lblog4j/**"/>



            <resource-root path="lblog4j.module/lblog4j.jar" />

            <resource-root path="lblog4j.module/log4j_org.jar" />




      Unfortunately this approach doesn't work - the library doesn't use the log4j_org.jar but rather log4j implementation provided by JBoss - I believe that this is because module is kind of list of classes and doesn't control dependencies after jboss starts.

      I also noted that module definition doesn't allow excluding implicit dependencies from being added at start time so I cannot exclude JBoss log4j from being added - deployment and subdeployments allow that.

      It's also interesting that from my experience log4j is an implicit dependency while I can't see it on the official implicit dependency list.


      So my question is - is there a way to define kind of subdeployment (but not war) containing only my library jar and jars that it depends on and exclude jboss log4j from it? I just want the library and its dependencies (jars) to be loaded in separate classloader.