views:

822

answers:

3

Hi, the validate function of the Hibernate Validator seems to be buggy (version hibernate-validator-4.0.2.GA.jar). Do I maybe miss a dependency?

Part of my stack trace:

java.lang.NoSuchMethodError: javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil;
        at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:33)
        at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:112)
        at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
        at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:764)
        at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:331)
        at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:278)
        at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:260)
        at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:213)
        at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
+1  A: 

I think it's due to the fact that it thinks you're using JPA2 but in fact you're using JPA1. Remove the jpa-api-2.0.Beta-20090815.jar which is included with the distribution of Hibernate Validator if you don't need it and try again.

Javi
We found a solution to our original problem and stopped searching on that point. So, I still don't know the solution but it must have something to do with the versions. Thank you for the help anyway..
ciaron
A: 

jpa-api-2.0.Beta-20090815.jar is not there in my classpath. Still I get this exception.not sure why

priya
A: 

Hi

Just now I found that there is a current dependency in java 6. Once i upgraded to java 6 all the errors above disappeared.

http://javaprogrammingtips4u.blogspot.com

priya