1 Reply Latest reply on Dec 11, 2001 3:40 PM by Michel de Groot

    log4j

    frank starsinic Newbie

      Does anyone know why i cannot for the life of me
      figure out how to PROPERLY use log4j with JBoss??

      log4j.jar is already in the jboss classpath so i should be able to use it.
      how is it possible that log4j is in the jboss classpath
      and i also get...
      java.lang.NoClassDefFoundError: org/apache/log4j/Category

      the only thing that seems to complicate the issue is that log4j is implemented as an MBean with jboss.

      the only way i can get log4j to work with jboss is to comment out the log4j MBean in jboss.conf


      any ideas?

      thanks,
      frank

      HERE'S MY STACKTRACE

      java.lang.NoClassDefFoundError: org/apache/log4j/Category
      at gov.ca.boe.util.Logger.addLoggingForClass(Logger.java)
      at gov.ca.boe.util.Msg.(Msg.java)
      at _0002fafsp_0005flogin_0002ejspafsp_0005flogin_jsp_62._jspService(_0002fafsp_0005flogin_0002ejspafsp_0005flogin_jsp_62.java:85)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
      at org.apache.tomcat.core.Handler.service(Handler.java:287)
      at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
      at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
      at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
      at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
      at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
      at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
      at java.lang.Thread.run(Thread.java:484)

        • 1. Re: log4j
          Michel de Groot Newbie

          I think the problem is you are trying to log from a JSP/servlet, which means that the Tomcat classloader is used.

          Try to add log4j.jar to WEB-INF/lib in the .war or, if this fails (there are some classloader bugs, at least in 2.4.0), add it to /lib. As a last resort, add it to the java CLASSPATH in jboss's run.sh