简体   繁体   中英

Hibernate Validation and Spring 3.x

I am trying to use validation with Spring 3.x.

I have annotated a method field with @Valid , added <mvc:annotation-driven/> to my common.xml , and added Hibernate-Validator.jar in the lib/ dir, but I keep getting this message: "Hibernate validator not found: ignoring" .

Am I missing something?

  [Version:15] Hibernate Annotations 3.4.0.GA
  [Environment:543] Hibernate 3.3.0.SP1
  [Environment:576] hibernate.properties not found
  [Environment:709] Bytecode provider name : javassist
  [Environment:627] using JDK 1.4 java.sql.Timestamp handling
  [Version:14] Hibernate Commons Annotations 3.1.0.GA
  [AnnotationConfiguration:369] Hibernate Validator not found: ignoring

It means that Hibernate can't find the classes org.hibernate.validator.ClassValidator or org.hibernate.validator.MessageInterpolator , hinting that there's a problem with the library versions in your classpath.

I see you're using the following versions:

  • Hibernate Annotations 3.4.0.GA
  • Hibernate 3.3.0.SP1
  • Hibernate Commons Annotations 3.1.0.GA

And your JAR is hibernate-validator-4.0.2.GA.jar . Are you sure that all of these versions are compatible with each other?

Please try downloading the newest versions of the different Hibernate components, put them in your classpath and see if the error is still there.

At last, I found the answer at Spring ROO Issue Tracker

it is a bug in Hibernate that is known to be corrected in Hibernate 3.5

I've this message too in my Spring project, but validation still works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM