SLF4J:Hibernate3 与 RESTeasy
在我的项目中,我使用 Hibernate3 (取决于 slf4j-1.6)和 RESTeasy (取决于 slf4j-1.5)。两者不兼容,并且在运行时会出错。
SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
at org.slf4j.impl.SimpleLogger.formatAndLog(SimpleLogger.java:222)
at org.slf4j.impl.SimpleLogger.info(SimpleLogger.java:258)
at org.hibernate.annotations.common.Version.<clinit>(Version.java:37)
有什么想法可以解决这个冲突吗?
In my project i'm using Hibernate3 (depends on slf4j-1.6) and RESTeasy (depends on slf4j-1.5). Both are not compatible and give errors at runtime.
SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
at org.slf4j.impl.SimpleLogger.formatAndLog(SimpleLogger.java:222)
at org.slf4j.impl.SimpleLogger.info(SimpleLogger.java:258)
at org.hibernate.annotations.common.Version.<clinit>(Version.java:37)
Any ideas to solve this conflict ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 RESTeasy 不熟悉,但是我以前遇到过这个问题,我刚刚将所有 slf4j jar 更新到更高版本,发现我使用的依赖于旧版本的 api 仍然可以在 1.6 版本上使用。
尝试一下吧,尝试一下总没有坏处。
编辑:我只想说,请确保将 slf4j api (slf4j-api-1.xxjar) 和插件(例如 slf4j-log4j12-1.xxjar)更新到相同版本。
I am not familiar with RESTeasy however I have encountered this problem before, I just updated all slf4j jars to the later version and found that the api I was using that depended on the older version still worked on version 1.6.
Give it a go it can't hurt to try.
Edit: I should just say, make sure you update both the slf4j api (slf4j-api-1.x.x.jar) and the plugin (e.g. slf4j-log4j12-1.x.x.jar) to the same version.