每当我在spring mvc中的调度程序servlet中添加<mvc:annotation-driven>时,我都会收到错误

时间:2015-12-22 09:32:45

标签: spring-mvc

我正在为@ResponseBody注释我的项目添加jQuery自动完成功能<mvc:annotation-driven />我需要dispatcher-servlet标记,但是当我添加它时,我收到以下错误:

  

org.springframework.beans.factory.BeanCreationException:使用名称&#39; org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0&#39;:创建bean的错误:init方法的调用失败;嵌套异常是javax.validation.ValidationException:无法找到默认提供者
  在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:291)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)~ [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]           在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)〜[spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]           在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)〜[spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]           在org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)〜[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]           在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)〜[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]           在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003)[catalina.jar:7.0.64]           at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517)[catalina.jar:7.0.64]           在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)[catalina.jar:7.0.64]           在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1574)[catalina.jar:7.0.64]           在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1564)[catalina.jar:7.0.64]           at java.util.concurrent.FutureTask.run(Unknown Source)[na:1.8.0_60]           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[na:1.8.0_60]           at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)[na:1.8.0_60]           at java.lang.Thread.run(Unknown Source)[na:1.8.0_60]       引起:javax.validation.ValidationException:无法找到默认提供程序           在javax.validation.Validation $ GenericBootstrapImpl.configure(Validation.java:264)〜[validation-api-1.0.0.GA.jar:na]           在org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:183)〜[spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)〜[spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]           ...省略了21个常用帧       2015年12月22日上午4:17:11 org.apache.catalina.core.StandardContext listenerStart       SEVERE:将上下文初始化事件发送到类org.springframework.web.context.ContextLoaderListener的侦听器实例的异常       org.springframework.beans.factory.BeanCreationException:使用名称&#39; org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0&#39;:创建bean的错误:init方法的调用失败;嵌套异常是javax.validation.ValidationException:无法找到默认提供程序           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)           at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:291)           在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)           在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)           在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)           在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)           在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)           在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)           在org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)           在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)           在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)           在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003)           at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517)           在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)           在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1574)           在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1564)           at java.util.concurrent.FutureTask.run(Unknown Source)           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)           at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)           在java.lang.Thread.run(未知来源)       引起:javax.validation.ValidationException:无法找到默认提供程序           at javax.validation.Validation $ GenericBootstrapImpl.configure(Validation.java:264)           at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:183)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)           ......还有21个       `

1 个答案:

答案 0 :(得分:1)

将以下依赖项添加到您的proyect:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>4.2.0.Final</version>
</dependency>