记录器与Jboss 5.1上的Hibernate 4的问题 [英] Logger problems with Hibernate 4 on Jboss 5.1

查看:171
本文介绍了记录器与Jboss 5.1上的Hibernate 4的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正试图将我们的Hibernate升级到v4.2.3,同时仍然运行在Jboss 5.1上。不幸的是,在部署时我们遇到了这个错误:


在类路径中定义名为'sessionFactory'的Bean时创建错误
资源[application-context-model.xml]:调用init方法
失败;嵌套异常是java.lang.NoSuchMethodError:
org.jboss.logging.Logger.getMessageLogger(Ljava / lang / Class; Ljava / lang / String;)Ljava / lang / Object;

据我们所知,这是由于与Jboss捆绑在一起的 jboss-logging-spi 之间的冲突。 jboss-logging-3.1.0.GA 需要Hibernate 4.2.3。



我们已经看到了这个问题,但答案对我们的案例没有帮助:在JBoss上的Hibernate4 EAP 5.1.2日志记录错误

我们尝试了一些技巧,但似乎没有任何效果。
有什么想法?

解决方案

如果这个问题是由两个库冲突造成的,而且无法删除一个实现,你可能想要尝试改变类加载的顺序。
这可以通过在部署工件中添加一个jboss-classloading.xml描述符来完成。



以下是如何在JBoss中配置部署类加载行为的示例。


We're trying to upgrade our Hibernate to v4.2.3 while still running on Jboss 5.1. Unfortunately at deploy time we're running into this error:

Error creating bean with name 'sessionFactory' defined in class path resource [application-context-model.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;

As far as we can tell this is due to a conflict between jboss-logging-spi bundled with Jboss and jboss-logging-3.1.0.GA required by Hibernate 4.2.3.

We've seen this question, but the answer did not help in our case: Hibernate4 on JBoss EAP 5.1.2 logging error

We've tried a bunch of "tricks", but nothing seems to work. Any ideas?

解决方案

If this problem is caused by the two libraries being in conflict, and you can not remove one implementation, you may want to try to change the order of classloading. This can be accomplished by adding a jboss-classloading.xml descriptor in your deployment artifact.

Here is an example of how to configure a deployment classloading behavior in JBoss.

这篇关于记录器与Jboss 5.1上的Hibernate 4的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆