Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8195096

Exception printed on console with custom LogManager on starting Apache Tomcat

XMLWordPrintable

    • b38
    • 10
    • b01
    • x86_64
    • linux
    • Verified

        FULL PRODUCT VERSION :
        java version "10-ea" 2018-03-20
        Java(TM) SE Runtime Environment 18.3 (build 10-ea+38)
        Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10-ea+38, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Linux study04 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Apache Tomcat, any currently supported version.

        A DESCRIPTION OF THE PROBLEM :
        Apache Tomcat provides a custom LogManager that is class loader aware. This is done to avoid issues of log mix-up where multiple web applications (each with their own class loader) create Loggers with the same name.

        The custom LogManager also permits multiple instances of the same Handler class to be created. It does this by the addition of a numerical prefix to the handler class name. As a result it treats the "handlers" and ".handlers" properties differently. The first defines all handlers, the second the handlers for the root logger.

        With the fix for JDK-8191033, the JRE provided LogManager class now tries to process the ".handlers" property. Because it sees a class name of, for example, "1catalina.org.apache.juli.AsyncFileHandler" it throws a CNFE.

        I've spent some time looking at the JRE LogManager implementation and I can see any easy way for a custom LogManager to work-around this.

        The simplest solution from my PoV would be to make createLoggerHandlers() protected so custom LogManager implementations take take appropriate action as necessary.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Download any current version of Apache Tomcat.
        Start it with Java 10 ea 38

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Clean start shown in logs / on console
        ACTUAL -
        The start-up log / console includes the following stack trace:

        Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler"
        java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
        java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        at java.logging/java.util.logging.LogManager.createLoggerHandlers(LogManager.java:1005)
        at java.logging/java.util.logging.LogManager.access$1000(LogManager.java:155)
        at java.logging/java.util.logging.LogManager$2.run(LogManager.java:401)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.logging/java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:382)
        at java.logging/java.util.logging.LogManager.getLogManager(LogManager.java:436)
        at java.logging/java.util.logging.Logger.demandLogger(Logger.java:648)
        at java.logging/java.util.logging.Logger.getLogger(Logger.java:717)
        at java.logging/java.util.logging.Logger.getLogger(Logger.java:701)
        at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:68)
        at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:188)
        at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:116)
        at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:139)
        at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:194)
        at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        See above.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        None found.

              dfuchs Daniel Fuchs
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: