【发布时间】:2011-10-06 09:25:05
【问题描述】:
我有一个在 Smartfox 服务器内运行的应用程序(扩展程序)。你们中的大多数人不会知道 Smartfox,但它的设置就像 Tomcat。即扩展有它自己的类加载器,它首先从扩展加载类,然后是全局服务器库(我将称之为selfish classloading,因为我不知道官方术语,如果存在的话)。
我有多个 SLF4J 绑定问题,我的扩展包含 logback,而服务器包含另一个 slf4j 绑定(这对我来说没用):
INFO | jvm 1 | 2011/10/06 11:10:25 | SLF4J: Class path contains multiple SLF4J bindings.
INFO | jvm 1 | 2011/10/06 11:10:25 | SLF4J: Found binding in [jar:file:/opt/smartfox/Server/lib/lsc.jar!/org/slf4j/impl/StaticLoggerBinder.class]
INFO | jvm 1 | 2011/10/06 11:10:25 | SLF4J: Found binding in [jar:file:/opt/smartfox/Server/wext/smilefish/logback-classic-jar-logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
我希望自私的类加载能解决这类问题,但显然它没有。如何在不删除任何绑定的情况下解决此问题?
(自私类加载器的源代码见Is there a Tomcat-like classloader that can be used standalone?)
【问题讨论】:
标签: java classloader slf4j logback