Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-14

jcl104-over-slf4j throws exception on release()

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • None
    • None
    • Implementations
    • None
    • Operating System: All
      Platform: PC

    Description

      Tomcat refuses to undeploy a webapp that uses jcl104-over-slf4j.
      This breaks hot-deployment, and sometimes seems to cause trouble when
      shutting down Tomcat.

      This has been reproduced in Tomcat 5.0.28 and Tomcat 5.5.15,
      but Tomcat 5.5.17 recovers from the problem and manages to
      undeploy the webapp anyway.

      I traced the cause to an exception thrown by:

      org.apache.commons.logging.impl.SLF4FLogFactory.release()

      This method unconditionally throws a runtime exception whenever it
      is called. The webapp has jcl104-over-slf4j.jar in its WEB-INF/lib,
      and when Tomcat undeploys the webapp, it somehow causes the release
      method to be called.

      Here is a small servlet that reproduces this behaviour:

      import javax.servlet.*;
      import javax.servlet.http.*;
      import org.apache.commons.logging.*;

      public class Hang extends HttpServlet {
      public void init(ServletConfig config) throws ServletException

      { super.init(config); Log log = LogFactory.getLog(getClass()); log.warn("foo"); }

      protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, java.io.IOException

      { resp.getWriter().println("<html><body>Hello, World!</body></html>"); }

      }

      Deploy together with jcl104-over-slf4j.jar and slf4j-simple.jar,
      and browse the webapp's URL to initialize it. Then re-create and
      redeploy the WAR file (or touch web.xml) to provoke the exception.

      Possible solutions: either upgrade to Tomcat 5.5.17, or patch
      src/java/org/apache/commons/logging/impl/SLF4FLogFactory.java
      so that release() doesn't throw this exception.

      Below are stacktraces for Tomcat 5.0.28, 5.5.15, and 5.5.17,
      all different. The 5.0.28 trace is not informative since it
      hides the original exception which is converted to a string
      before it is rethrown.

      ---------Tomcat 5.0.28----------------------------------------------

      May 24, 2006 9:03:43 AM org.apache.catalina.core.ContainerBase log
      INFO: Removing web application at context path /hang
      May 24, 2006 9:03:43 AM org.apache.catalina.startup.HostConfig
      checkContextLastModified
      SEVERE: Cannot find message associated with key hostConfig.undeployJar.error
      java.io.IOException: java.lang.UnsupportedOperationException: SLF4J bound
      commons-logging does not need to implement release().
      at
      org.apache.catalina.core.StandardHostDeployer.remove(StandardHostDeployer.java:796)
      at org.apache.catalina.core.StandardHost.remove(StandardHost.java:971)
      at
      org.apache.catalina.startup.HostConfig.checkContextLastModified(HostConfig.java:840)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1085)
      at
      org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:327)
      at
      org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at
      org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:800)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1619)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1628)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1608)
      at java.lang.Thread.run(Thread.java:534)
      May 24, 2006 9:03:43 AM org.apache.catalina.core.StandardHostDeployer install
      INFO: Installing web application at context path /hang from URL
      file:/usr/local/tomcat5/webapps/hang

      ---------Tomcat 5.5.15----------------------------------------------

      May 24, 2006 8:53:37 AM org.apache.catalina.startup.HostConfig checkResources
      INFO: Undeploying context [/hang]
      May 24, 2006 8:53:37 AM
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor processChildren
      SEVERE: Exception invoking periodic operation:
      java.lang.UnsupportedOperationException: SLF4J bound commons-logging does not
      need to implement release().
      at
      org.apache.commons.logging.impl.SLF4FLogFactory.release(SLF4FLogFactory.java:168)
      at org.apache.commons.logging.LogFactory.release(LogFactory.java:388)
      at
      org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1634)
      at
      org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1489)
      at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:706)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4360)
      at
      org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:892)
      at
      org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:984)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1178)
      at
      org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
      at
      org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at
      org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1304)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
      at java.lang.Thread.run(Thread.java:595)
      May 24, 2006 8:53:47 AM org.apache.catalina.startup.HostConfig checkResources
      INFO: Undeploying context [/hang]
      May 24, 2006 8:53:47 AM
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor processChildren
      SEVERE: Exception invoking periodic operation:
      java.lang.NullPointerException
      at
      org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:883)
      at
      org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:984)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1178)
      at
      org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
      at
      org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at
      org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1304)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
      at java.lang.Thread.run(Thread.java:595)

      ---------Tomcat 5.5.17----------------------------------------------

      May 24, 2006 8:45:22 AM org.apache.catalina.startup.HostConfig checkResources
      INFO: Undeploying context [/hang]
      May 24, 2006 8:45:22 AM org.apache.catalina.startup.HostConfig checkResources
      WARNING: Error while removing context [/hang]
      java.lang.UnsupportedOperationException: SLF4J bound commons-logging does not
      need to implement release().
      at
      org.apache.commons.logging.impl.SLF4FLogFactory.release(SLF4FLogFactory.java:168)
      at org.apache.commons.logging.LogFactory.release(LogFactory.java:388)
      at
      org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1634)
      at
      org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1489)
      at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:706)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4387)
      at
      org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:892)
      at
      org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:979)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1187)
      at
      org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
      at
      org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at
      org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
      at
      org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
      at java.lang.Thread.run(Thread.java:595)
      May 24, 2006 8:45:22 AM org.apache.catalina.startup.HostConfig deployWAR
      INFO: Deploying web application archive hang.war

      Attachments

        Activity

          People

            slf4j-dev SLF4J developers list
            bjorn@implior.se bjorn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: