Error in Eclipse-Tomcat Setup - ClassNotFoundException "1catalina.org.apache.juli.FileHandler"

vjkumar picture vjkumar · Oct 4, 2012 · Viewed 23.3k times · Source

Setup: Eclipse Juno R, Tomcat 7.0.8, tomcat run through eclipse plug in. Tomcat launch configuration from eclipse has VM argument -Djava.util.logging.config.file="C:\WS\Serverlogs\tomcat7\conf\logging.properties" (Ref: Where can I view Tomcat log files in Eclipse?) Getting following error.

Can't load log handler "1catalina.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.util.logging.LogManager$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
    at java.util.logging.LogManager.addLogger(Unknown Source)
    at java.util.logging.LogManager$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.logging.LogManager.<clinit>(Unknown Source)
    at java.util.logging.Logger.getLogger(Unknown Source)
    at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:71)
    at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:196)
    at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170)
    at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:242)
    at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:293)
    at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:57)
Can't load log handler "1catalina.org.apache.juli.FileHandler"

There are similar errors for "1catalina.org.apache.juli.FileHandler","2localhost.org.apache.juli.FileHandler" and others. I understand that these classes come from tomcat-juli.jar at /bin. I added this jar into server classpath (Eclipse -> Servers -> Open -> Open Lauch configuration -> Classpath -> User Entries), but got the same error. Contents of logging.properties are:

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler

Any input / guidance is most appreciated. Found these How to configure Tomcat JULI logging to roll log files? Local Tomcat Environment Not Starting , but my issue seems to be different.

Edit1 Adding "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" to server's VM Argument and changing "\" to "/" in the logging.properties did the trick. Thanks to Robin for the pointer to Tomcat Logging FAQ

Thank you, VJ

Answer

John McCarthy picture John McCarthy · Jan 2, 2013

Ensure the following system property is set,

-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

As seen here on the tomcat users mailing list.

I had the same problem launching tomcat with YAJSW instead of using the tomcat startup scripts.