我试图从像这样的启动bean中运行joranConfigurator
private void configureLogBack() {
LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();
try {
File f = new File("mypath/loggerConfiguration.xml");
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
// Call context.reset() to clear any previous configuration, e.g.
// default
// configuration. For multi-step configuration, omit calling
// context.reset().
context.reset();
//configurator.doConfigure(System.getenv("obphm.logPath"));
configurator.doConfigure(f);
} catch (JoranException je) {
// StatusPrinter will handle this
}
StatusPrinter.printInCaseOfErrorsOrWarnings(context);
}
我即将获得此异常
java.lang.ClassNotFoundException: org.xml.sax.InputSource
这是用于logback,我不使用logback.xml,因为项目架构师告诉我他想这样做...我做了一些研究,显然我有两个相互矛盾的xml api jar ...有没有办法修复此问题而不删除其他jar(部分是因为我不知道哪个其他jar有冲突)??
这是slf4j
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.slf4j.v175">
<resources>
<resource-root path="slf4j-api-1.7.5.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="ch.qos.logback"/>
</dependencies>
</module>
这是logback
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="ch.qos.logback">
<resources>
<resource-root path="logback-classic-1.1.1.jar"/>
<resource-root path="logback-core-1.1.1.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="org.slf4j.v175"/>
</dependencies>
</module>
答案 0 :(得分:0)
通过删除我制作的自定义logback / slf4j模块并将所需的jar文件捆绑在ear文件中来解决此问题。除了我列出的子部署之外,还修复了我的jboss-deployment-structure.xml以包含主要部署