3 Replies Latest reply on Nov 16, 2006 10:58 AM by Peter Johnson

    Log4j an JBOSS 4.0.5

    Russ Newbie

      I have downloaded the latest version and ran the window installer.

      Where I start the server up, an error displays involving the log4j component. I have not changed the log4j.xml settings, so I am confused why this error would even happen:

      20:05:44,757 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "org.apache.log4j.spi.ErrorHandler" variable.
      20:05:44,757 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
      20:05:44,757 ERROR [STDERR] log4j:ERROR [WebappClassLoader
       delegate: false
       repositories:
       /WEB-INF/classes/
      ----------> Parent Classloader:
      java.net.FactoryURLClassLoader@31c43f
      ] whereas object of type
      20:05:44,757 ERROR [STDERR] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@ab95e6].
      20:05:44,820 ERROR [STDERR] log4j:ERROR Could not create an Appender. Reported error follows.
      20:05:44,820 ERROR [STDERR] java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender
      


      I checked to ensure I had the log4j.jar (or something like it) within the server area. I found log4j-boot.jar found in <JBOSS_DIR>/lib, so I am at a lost to explain why there is an issue.

      Can someone shed some light on this for me?

        • 1. Re: Log4j an JBOSS 4.0.5
          Peter Johnson Master

          I have seen the "OnlyOnceErrorHandler" error happen when I have deployed an application that contains its own log4j.jar and commons-logging.jar files. Removing those files from my application solved the problem.

          • 2. Re: Log4j an JBOSS 4.0.5
            Russ Newbie

            Peter:

            Thank you VERY much for your reply...

            Yes, I think this could be the issue I am facing....but I am perplexed on a clean solution. If I rip out the log4j.jar file from my projects and remove the all references from the projects, I am not able to compile the source code. If delete the jar files already in the deployed project on JBoss, the server still sees it and throws an error.

            What I think I need is a clean solution so I can build on my box and deploy the J2EE project over to JBOSS (also on my box) without and yanking of jars.

            How do you do it?


            Thanks as always for reading my post!

            Russ

            • 3. Re: Log4j an JBOSS 4.0.5
              Peter Johnson Master

              Note that the only steps I took were to remove the two jar files from my war/ear file. My code still uses commons logging with log4j, so I still compile with the commons logging jar in my classpath, I just don't deploy with it. At runtime, my code uses the commons logging and log4j jars provided by JBoss.