本文介绍了Maven的:一起休眠-的EntityManager带的JavaEE-API打破我的单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个依赖的JavaEE-API 的Hibernate的EntityManager 在我聚甲醛。但他们并没有很好地协同工作:一旦我添加的JavaEE的API,我所有的单元测试 java.lang.ClassFormatError打破由于:在法缺席code属性是不是本机或抽象类文件的javax /确认/验证。如果没有JavaEE的API,一切工作正常。这是为什么?

I'm having the two dependencies javaee-api and hibernate-entitymanager in my pom. But they don't work very well together: as soon as I add javaee-api, all my unit tests break due to java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation. Without javaee-api, everything works fine. Why is that?

(这个问题是为了适应问题被编辑;))

推荐答案

这是由在java-EE-api.jar文件中包含的的。有替代依赖围绕解决这个问题。在pom.xml更改顺序为我做的伎俩了。

This is caused by the fact that the java-ee-api.jar contains crippled classes. There are alternative dependencies around which fix this problem. Changing the order in the pom.xml did the trick for me, too.

这篇关于Maven的:一起休眠-的EntityManager带的JavaEE-API打破我的单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 05:46