Skip to content

SandboxClassLoader的parent为AppClassLoader导致的logback加载问题 #14

Closed
@diecui1202

Description

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/zhuyong/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/zhuyong/github/jvm-sandbox/target/sandbox/lib/../lib/sandbox-core.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/zhuyong/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/folders/_8/t39d5h3s6ql89cqwy7j470sc0000gn/T/sandbox_module_jar_5526050970864565436.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

当应用AppClassLoader中有logback时,sandbox启动时,会在应用的控制台日志中输出如上的信息,原因是SandboxClassLoader的parent为AppClassLoader,Slf4j在初始化时会扫描classpath下的实现类,这时会加载到应用中的资源;

建议是将SandboxClassLoader的parent设置为ext classloader。

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions