I am trying to run a dbtest but I get the following error :
\"Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bea
This sounds like a ClassLoader conflict. I'd bet you have the javax.persistence api 1.x on the classpath somewhere, whereas Spring is trying to access ValidationMode, which was only introduced in JPA 2.0.
Since you use Maven, do mvn dependency:tree, find the artifact:
javax.persistence
persistence-api
1.0
And remove it from your setup. (See Excluding Dependencies)
AFAIK there is no such general distribution for JPA 2, but you can use this Hibernate-specific version:
org.hibernate.javax.persistence
hibernate-jpa-2.0-api
1.0.1.Final
OK, since that doesn't work, you still seem to have some JPA-1 version in there somewhere. In a test method, add this code:
System.out.println(EntityManager.class.getProtectionDomain()
.getCodeSource()
.getLocation());
See where that points you and get rid of that artifact.
Ahh, now I finally see the problem. Get rid of this:
org.springframework
spring-jpa
2.0.8
and replace it with
org.springframework
spring-orm
3.2.5.RELEASE
On a different note, you should set all test libraries (spring-test, easymock etc.) to
test