1 Reply Latest reply on Apr 29, 2016 11:51 AM by Vang Yang

    Creating Log4j2 2.5 module in Wildfly 9

    Vang Yang Newbie

      Hello,

       

      I'm trying to create/add a log4j 2 ver 2.5 to WildFly 9.0.2, however when I run my code I get the following error:

       

      java.lang.Exception: {

          "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"test.war\"

          Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger

          Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger from [Module \"deployment.test.war:main\" from Service Module Loader]"},

          "WFLYCTL0180: Services with missing/unavailable dependencies" => [

              "jboss.deployment.unit.\"test.war\".batch.environment is missing [jboss.deployment.unit.\"test.war\".beanmanager]",

              "jboss.deployment.unit.\"test.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"test.war\".beanmanager]"

          ]

      }

       

      my module is as follows:
      org/apache/logging/log4j/main/module.xml for the api:

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.1" name="org.apache.logging.log4j">

        <resources>

              <resource-root path="log4j-api-2.5.jar"/>

          </resources>

      </module>

       

      org/apache/logging/log4j/core/main/module.xml for the core:


      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.1" name="org.apache.logging.log4j.core">

        <resources>

              <resource-root path="log4j-core-2.5.jar"/>

          </resources>

       

        <dependencies>

        <module name="org.apache.logging.log4j"/>

        </dependencies>

      </module>

       

      org/apache/logging/log4j/web/main/module.xml for the core:


      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.1" name="org.apache.logging.log4j.web">

        <resources>

              <resource-root path="log4j-web-2.5.jar"/>

          </resources>

       

        <dependencies>

              <module name="org.apache.logging.log4j"/>

        <module name="org.apache.logging.log4j.core"/>

        </dependencies>

      </module>

       

      can anyone point me to the right direction.

       

      vpyang

        • 1. Re: Creating Log4j2 2.5 module in Wildfly 9
          Vang Yang Newbie

          Looks like moving api module and adding dependencies as well as adding load to standealone.xml fixes it:

           

          org/apache/logging/log4j/api/main/module.xml for the api:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.1" name="org.apache.logging.log4j.api">

            <resources>

                  <resource-root path="log4j-api-2.5.jar"/>

              </resources>

          </module>

           

          org/apache/logging/log4j/core/main/module.xml for the core:


          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.1" name="org.apache.logging.log4j.core">

            <resources>

                  <resource-root path="log4j-core-2.5.jar"/>

              </resources>

           

            <dependencies>

            <module name="org.apache.logging.log4j.api"/>

            <module name="javaee.api"/>

            </dependencies>

          </module>

           

          org/apache/logging/log4j/web/main/module.xml for the core:


          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.1" name="org.apache.logging.log4j.web">

            <resources>

                  <resource-root path="log4j-web-2.5.jar"/>

              </resources>

           

            <dependencies>

                  <module name="org.apache.logging.log4j.api"/>

            <module name="org.apache.logging.log4j.core"/>

          <module name="javax.servlet.api"/>

            </dependencies>

          </module>