Eclipse-Tomcat Setup 中的错误 - ClassNotFoundException “1catalina.org.apache.juli.FileHandler”
设置:Eclipse Juno R,Tomcat 7.0.8,Tomcat通过eclipse插件运行。Tomcat 从 eclipse 启动配置具有 VM 参数 -Djava.util.logging.config.file=“C:\WS\Serverlogs\tomcat7\conf\logging.properties” (Ref: Where I can view Tomcat log files in Eclipse?)获取以下错误。
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"
“1catalina.org.apache.juli.FileHandler”,“2localhost.org.apache.juli.FileHandler”等也有类似的错误。我知道这些类来自tomcat-juli.jar在/bin。我将此 jar 添加到服务器类路径中(Eclipse -> Servers -> Open -> Open Lauch 配置 -> Classpath -> User Entrys),但得到了相同的错误。logging.properties 的内容包括:
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
任何输入/指导都是最值得赞赏的。发现这些 如何配置 Tomcat JULI 日志记录以滚动日志文件? 本地 Tomcat 环境未启动 ,但我的问题似乎不同。
编辑1将“-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager”添加到服务器的VM Argument中,并在loging.properties中将“\”更改为“/”,这就成功了。感谢 Robin 提供指向 Tomcat Logging FAQ 的指针
谢谢你,VJ