开发者

How to set Hibernate validator in Tapestry?

开发者 https://www.devze.com 2023-04-10 01:47 出处:网络
Hi I\'m trying to copy the quick start skeleton of Tapestry 5.2 to Dynamic Web project in eclipse. In the quick start project I can generate the war file and run it in Tomcat but when I try to copy th

Hi I'm trying to copy the quick start skeleton of Tapestry 5.2 to Dynamic Web project in eclipse. In the quick start project I can generate the war file and run it in Tomcat but when I try to copy the project with the开发者_如何学C dependences to a new Dynamic Web project it throw a exception:

Caused by: java.lang.ClassNotFoundException: javax.validation.ValidatorFactory

I did copy the hibernate validator to web-inf/lib but tapestry can't find it. How would I set it in Tapestry?


I don't believe this has anything to do with tapestry or hibernate. You are missing javax.validation.ValidatorFactory on your classpath. This class is packaged with JEE6 which in your case is most likely provided by your Tomcat version but not by your Eclipse Web Project.

You will need to tell your Web Project to use JEE6 or add the jar manually yourself to the projects classpath.


Here is one way that I found out, hope that it works for you.

(a) i am running tapestry from eclipse indigo.

(b) i obtained a copy of tapestry-bin-5.2.6.tar.gz

(c) stored all the files present in the lib folder of the above distribution in a folder (say foo) referenced by classpath

(d) then obtained the following files from various locations on the web an stored them in the same folder (foo)

(1) javax.validation-1.0.0.GA.jar (from http://www.java2s.com/Code/Jar/j/Downloadjavaxvalidation100GAjar.htm)
(2) hibernate-validator-4.2.0.Final and hibernate-validator-annotation-processor-4.2.0.Final
(from http://sourceforge.net/projects/hibernate/files/hibernate-validator/)

(e) restarted eclipse - and it worked !

0

精彩评论

暂无评论...
验证码 换一张
取 消