提升问题:在 Jetty:Run 上遇到 Log4J 错误
这个问题似乎很常见,但到目前为止我还没有找到一个有用的解决方案。
我使用 net.liftweb
空白原型(版本 2.2-M1)和 maven 2 创建了一个项目。我刚刚为 H2 数据库添加了一个依赖项,然后还添加了一些模型和 DBVendor,就像在基本原型。但我只遇到过像 java.lang.NoClassDefFoundError: org/apache/log4j/LogManager 这样的异常。
现在,记录器对于整个程序来说并不重要,但是当涉及到映射器的后续问题时,我想我需要日志来进行调试。我执行了完整的 mvn clean
并删除了我的 .m2
文件夹,但问题仍然存在。
或者,每当该错误没有出现时,我就会收到另一个错误,关于类缺少 aend,因此记录器诉诸 NOP。我什至相信我的 pom.xml 有问题,但我现在已经尝试了 log4j deps 的几种变体,所有这些都没有改善。
我真的希望你能在这里帮助我,到目前为止,Lift 对我来说是一系列未记录的错误,远远超出了一点学习乐趣已经演变成个人挑战的程度。
This problem seems to be quite common, but so far I have not found one single, useful solution.
I created a project using the net.liftweb
blank archetype, version 2.2-M1, with maven 2. I just added one dependency, for H2 database, then also added some models and a DBVendor, like in the basic archetype. But I only ever get an exception like java.lang.NoClassDefFoundError: org/apache/log4j/LogManager
.
Now, the logger is not vital for the entire program, bit when it comes to later problems with the mapper, I think I need the logs for debugging. I did a complete mvn clean
and also deleted my .m2
folder, but the problem persists.
Alternatively, whenever that error does not appear, I get another one, about a class missing aend thus the logger resorting to NOP. I got as far as to believe there's something wrong with my pom.xml, but I have now tried several variants with the log4j deps, all leading to no improvement.
I really hope you can help me here, Lift has been so far a series of undocumented error to me, way beyond the point where a little learning fun has morphed into a personal challenge.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了。我将解决方案放在这里,以便其他人可以找到它:
在 wiki 中没有任何地方说
Log.infoF
已被弃用并会导致此错误。解决方案非常简单,只需将其替换为Schemifier.infoF _
,该行必须如下所示:这样就可以了。
Solved. I put the solution here so others will find it:
Nowhere in the wiki it says that
Log.infoF
is deprecrated and will result in this error. The solution is quite simple, just replace it withSchemifier.infoF _
, the line must look like this:This works all right.