4 Replies Latest reply on Jun 27, 2006 2:55 PM by roy.russo

    FYI: log4j in portlet WAR

      Don't include a log4j.jar in your portlet WAR. The error message you will see is:

      2005-05-24 13:55:54,919 INFO [STDOUT] log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
      2005-05-24 13:55:54,919 INFO [STDOUT] log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
      2005-05-24 13:55:54,919 INFO [STDOUT] log4j:ERROR [WebappClassLoader
       delegate: false
       repositories:
       /WEB-INF/classes/
      ----------> Parent Classloader:
      java.net.FactoryURLClassLoader@39826
      ] whereas object of type
      2005-05-24 13:55:54,919 INFO [STDOUT] log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [org.jboss.mx.loading.UnifiedClassLoader3@186df0f{ url=file:/C:/jboss-4.0.2/server/default/tmp/deploy/tmp55693jboss-service.xml ,addedOrder=2}].
      2005-05-24 13:55:54,919 INFO [STDOUT] log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].
      


      I know using a JAR that is in base JBoss or in a surrounding application is a general no-no, and maybe this is a general JBoss 4.0.X exception, but I had not seen it before.

      Removing the log4j.jar from your WAR stops the exception and the JBoss logger works.


      Sherman


        • 1. Re: FYI: log4j in portlet WAR
          echoi1975

          i forgot where i read it, but there is a provision somewhere in one of the jboss admin docs that tells you what to change in one of your xml config files pkg'd with your war so that if you decide to use your own log4j config file you can deploy your own log4j jar file as well so that jboss doesn't try use logging configured for jboss on to the war deployment itself.

          you also have to update the jboss-service.xml config of the jboss server to tell it to use it's own logging config file which is usually the log4j xml already used, and changing its name to jboss-log4j.xml and updating the reference of it in the jboss-service.xml file.

          • 2. Re: FYI: log4j in portlet WAR
            koti123456

            Hi,
            I have read the wiki document that you are talking about.
            But still getting the same deployment error of log4j.jar
            when I take it out, complete logging is going in my application log file
            (including jboss & my app war)


            Please help me out

            Thanks,
            Prasad

            • 3. Re: FYI: log4j in portlet WAR
              koti123456

              Guys,


              Any Help on this??


              Thanks

              • 4. Re: FYI: log4j in portlet WAR

                Not a portal issue. Perhaps post in one of the JBoss AS forums?