Grails 应用程序中的 Log4J 问题依赖于 commons-logging
我正在向我的 Grails 项目添加一个依赖项,该项目将 commons-logging 和 log4j 作为传递依赖项引入。当我运行我的应用程序时,我收到一个错误
Error Error executing script RunApp: Could not initialize class
org.apache.log4j.LogManager (NOTE: Stack trace has been filtered. Use --verbose to see
entiretrace.) java.lang.NoClassDefFoundError: Could not initialize class
org.apache.log4j.LogManager
,我尝试按照 此链接,排除公共日志记录。但这从来没有帮助。我发现 commons-logging 不是我添加的依赖项的直接依赖项。那么,
runtime ('com.company.i18n:i18n:1.3.4')
{
excludes 'commons-logging'
}
它是否会排除我的依赖项中的所有公共日志依赖项?或者只是直接的。我该如何解决这个问题?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我努力尝试从所有依赖项中排除“log4j”,但没有任何效果。最后,我通过避免所有传递依赖项然后添加必要的内容来解决这个问题。
I tried hard by excluding "log4j" from all the dependencies, but nothing worked. Finally I solved this by avoiding all the transitive dependencies and then adding what ever was necessary.