次のようなバリデーターを使用している春のプロジェクトがあります。
<beans:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application"
p:fallbackToSystemLocale="false" />
<beans:bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<beans:property name="validationMessageSource" ref="messageSource" />
</beans:bean>
<annotation-driven validator="validator" />
<resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**" />
プロジェクトを実行すると、次のようになりますBeanCreationException
。
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'validator' defined in ServletContext resource [/WEB-INF/spring/appServlet
/servlet-context.xml]: Error setting property values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property 'validationMessageSource' threw exception; nested exception is
java.lang.NoClassDefFoundError: org/hibernate/validator/resourceloading/ResourceBundleLocator
これがPOMの私のスニペットです:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.3.2.RELEASE</version>
</dependency>
<!-- Hibernate entity manager with JPA 2 support. -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.0.Beta2</version>
</dependency>
<!-- Hibernate’s implementation of JSR-303. -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<!-- The JSR-303 Bean Validation API library. -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
なぜこのエラーが発生するのですか?
ありがとう