ASM 3.1 与 HIbernate 和 JAX-RS 的兼容性问题
我发现“Hibernate 无法与 JAX-RS 的参考实现结合”。 在链接http://lists.jboss.org/pipermail/ hibernate-issues/2009-May/015628.html
所以我无法将 JAX-RS (球衣)与 hibernate 结合起来,有人知道解决这个问题的方法吗?
I have found out that "Hibernate cannot be combined with the reference implementation of JAX-RS." on the link http://lists.jboss.org/pipermail/hibernate-issues/2009-May/015628.html
So i am unable to combine JAX-RS (jersey) with hibernate, does anybody know a work around for this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
万恶之源是cglib。 将 cglib-2.1.3.jar 替换为 cglib-nodep-2.1_3.jar 并删除 hibernate 的 asm*.jar 文件。
The root of evil is cglib. Substitute cglib-2.1.3.jar to cglib-nodep-2.1_3.jar and delete hibernate's asm*.jar files.
将 Jersey(Java REST 框架)与 Hibernate 结合使用需要对 Maven 的 pom.xml 文件进行一些调整。 问题在于 Hibernate 使用
ASM 1.5.3
,它与 Jersey 使用的ASM 3.1
不兼容。您需要做的是从 Hibernate 中排除一些传递依赖项:
然后,您需要包含正确的 ASM 版本:
最后,您需要包含 CGLib 的 nodep 版本,它从 ASM 版本重新打包类1.5.3:
来源:http://blog.idm.fr/2009 /04/jersey-hibernate-conflict.html
Using Jersey (the Java REST framework) in conjunction with Hibernate requires some tweaking of Maven's pom.xml file. The issue is that Hibernate uses
ASM 1.5.3
which is incompatible withASM 3.1
used by Jersey.What you need to do is exclude some transitive dependencies from Hibernate:
Then, you need to include the correct version of ASM:
Finally, you need to include a nodep version of the CGLib which repackages classes from ASM version 1.5.3:
source: http://blog.idm.fr/2009/04/jersey-hibernate-conflict.html
升级到 Hibernate 3.3.2 或更高版本。
如果您点击链接到生成消息的 错误报告 ,它表明最新版本的 Hibernate(自 3.3.2 起)使用不同的字节码操作包(Javassist),这消除了导致问题的 ASM 冲突。
Upgrade to a Hibernate 3.3.2 or later.
If you follow the link to the bug report that message was generated from, it indicates that the latest versions of Hibernate (since 3.3.2) use a different bytecode manipulation package (Javassist), which eliminates the conflict over ASM which caused the problem.
解决方案:ASM 3.1 与 HIbernate 和 JAX-RS 的兼容性问题
删除以下 jar
1 asm-attrs.jar
2 asm.jar
3 cglib-2.1.3.jar
添加以下 jar
1 asm-3.1.jar
2 cglib-nodep-2.1_3.jar
SOLUTION: Compatibility Issue of ASM 3.1 and HIbernate and JAX-RS
Remove the following jars
1 asm-attrs.jar
2 asm.jar
3 cglib-2.1.3.jar
Add the below jar
1 asm-3.1.jar
2 cglib-nodep-2.1_3.jar