views:

44

answers:

1

I am new to Spring and having issues with JSR303 Validation. The problem appears to be with the <mvc:annotation-driven/> tag in spring-servlet.xml.

When I include this tag I get the following error on startup of the development server.

    SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to find a default provider

I have no idea how to interpret this message. I am using validation-api-1.0.0.GA.jar which is in the WEB-INF/lib directory and on my eclipse build path.

Any ideas?

+2  A: 

It looks like you don't have any JSR-303 provider in your classpath. validation-api-1.0.0.GA.jar defines only the JSR-303 contract, and you will need either hibernate validator or apache bean validation to be present to perform the validations.

You can check a question regarding the 2 JSR-303 providers here: http://stackoverflow.com/questions/1384968/is-there-an-implementation-of-jsr-303-bean-validation-available

bashflyng