2012-08-22 28 views
0

當我嘗試在Spring MVC項目中添加驗證,但是當我添加的jar:錯誤添加驗證-API 1.0.0.GA.jar類路徑

驗證-API-1.0.0。 GA.jar

我得到這個錯誤產生豆例外org.springframework.beans.factory.BeanCreationException

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.seprof.service.UserService com.seprof.web.controller.AdminController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.seprof.dao.UserDAO com.seprof.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myUserDAO' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'myHibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myHibernateTemplate' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) 
     at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) 
     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) 
     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) 
     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723) 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
     at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075) 
     at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:383) 
     at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:362) 
     at org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.detectHandlers(AbstractDetectingUrlHandlerMapping.java:82) 
     at org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.initApplicationContext(AbstractDetectingUrlHandlerMapping.java:58) 
     at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119) 
     at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72) 
     at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73) 
     at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:106) 
     at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:85) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) 
     ... 19 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.seprof.service.UserService com.seprof.web.controller.AdminController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.seprof.dao.UserDAO com.seprof.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myUserDAO' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'myHibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myHibernateTemplate' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502) 
     at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84) 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282) 
     ... 39 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.seprof.dao.UserDAO com.seprof.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myUserDAO' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'myHibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myHibernateTemplate' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703) 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474) 
     ... 41 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.seprof.dao.UserDAO com.seprof.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myUserDAO' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'myHibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myHibernateTemplate' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502) 
     at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84) 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282) 
     ... 52 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myUserDAO' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'myHibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myHibernateTemplate' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703) 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474) 
     ... 54 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myHibernateTemplate' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) 
     ... 67 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) 
     ... 84 more 
    Caused by: java.lang.reflect.InvocationTargetException 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
     at java.lang.reflect.Method.invoke(Unknown Source) 
     at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:118) 
     ... 92 more 
    Caused by: java.lang.NoClassDefFoundError: javax/validation/Validation 
     at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:380) 
     at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:109) 
     ... 97 more 
    Caused by: java.lang.ClassNotFoundException: javax.validation.Validation 
     at java.net.URLClassLoader$1.run(Unknown Source) 
     at java.net.URLClassLoader$1.run(Unknown Source) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(Unknown Source) 
     at java.lang.ClassLoader.loadClass(Unknown Source) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
     at java.lang.ClassLoader.loadClass(Unknown Source) 
     ... 99 more 

我不知道爲什麼,任何幫助嗎?

這是類路徑:

<?xml version="1.0" encoding="UTF-8"?> 
<classpath> 
    <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/> 
    <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/> 
    <classpathentry including="**/*.java" kind="src" path="src/main/java"/> 
    <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/> 
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"> 
     <attributes> 
      <attribute name="owner.project.facets" value="java"/> 
     </attributes> 
    </classpathentry> 
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"> 
     <attributes> 
      <attribute name="owner.project.facets" value="jst.web"/> 
     </attributes> 
    </classpathentry> 
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> 
    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/antlr-2.7.7.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/aopalliance-1.0.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/commons-collections-3.2.1.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/commons-dbcp-1.2.2.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/commons-logging-1.1.1.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/commons-pool-1.3.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/dom4j-1.6.1.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/hibernate3.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/hsqldb-1.8.0.7.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/javassist-3.15.0-GA.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jstl-1.2.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jta-1.1.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/mysql-connector-java-5.0.5.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.instrument-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.test-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.web.portlet-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/org.springframework.web.struts-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/sitemesh-2.4.2.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/slf4j-api-1.6.1.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar"/> 
    <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/standard-1.1.2.jar"/> 

,這是應用程序上下文:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" 
    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd 
     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
     http://www.springframework.orgA/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

    <mvc:annotation-driven /> 
    <!-- Auto-detect components --> 
    <context:component-scan base-package="com.seprof.web.controller" /> 

    <bean id="messageSource" 
     class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
     <property name="basename" value="classpath:messages" /> 
     <property name="defaultEncoding" value="UTF-8" /> 
    </bean> 

    <bean id="propertyConfigurer" 
     class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
     p:location="/WEB-INF/jdbc.properties" /> 

    <bean id="viewResolver" 
     class="org.springframework.web.servlet.view.InternalResourceViewResolver" 
     p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"> 
    </bean> 

    <bean id="myDataSource" destroy-method="close" 
     class="org.apache.commons.dbcp.BasicDataSource"> 
     <property name="driverClassName" value="${jdbc.driverClassName}" /> 
     <property name="url" value="${jdbc.databaseurl}" /> 
     <property name="username" value="${jdbc.username}" /> 
     <property name="password" value="${jdbc.password}" /> 
<!--  <property name="initialSize" value="20" /> --> 
<!--  <property name="maxActive" value="30" /> --> 

    </bean> 

    <bean id="mySessionFactory" 
     class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
     <property name="dataSource" ref="myDataSource" /> 
     <property name="annotatedClasses"> 
      <list> 
       <value>com.seprof.pojo.User</value> 
       <value>com.seprof.pojo.Role</value> 
       <value>com.seprof.pojo.Country</value> 
      </list> 
     </property> 
     <property name="hibernateProperties"> 
      <props> 
       <prop key="hibernate.dialect">${jdbc.dialect}</prop> 
       <prop key="hibernate.show_sql">true</prop> 
       <prop key="hibernate.hbm2ddl.auto">update</prop> 
      </props> 
     </property> 
    </bean> 

    <bean id="myHibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> 
     <property name="sessionFactory"> 
      <ref bean="mySessionFactory" /> 
     </property> 
    </bean> 
    <!-- DAO --> 
    <bean id="myUserDAO" class="com.seprof.dao.UserDAOImpl"> 
     <property name="hibernateTemplate" ref="myHibernateTemplate" /> 
    </bean> 
    <bean id="myCommonDAO" class="com.seprof.dao.CommonDAOImpl"> 
     <property name="hibernateTemplate" ref="myHibernateTemplate" /> 
    </bean> 

    <!-- Service --> 
    <bean id="userService" class="com.seprof.service.UserServiceImpl"> 
     <property name="userDAO" ref="myUserDAO" /> 
    </bean> 
    <bean id="commonService" class="com.seprof.service.CommonServiceImpl"> 
     <property name="commonDAO" ref="myCommonDAO" /> 
    </bean> 

    <bean id="userValidator" class="com.seprof.web.validator.UserValidator" /> 

    <!-- <tx:annotation-driven /> --> 
    <!-- <bean id="transactionManager" --> 
    <!-- class="org.springframework.orm.hibernate3.HibernateTransactionManager"> --> 
    <!-- <property name="sessionFactory" ref="mySessionFactory" /> --> 
    <!-- </bean> --> 
</beans> 

回答

0

看來你還沒有定義的SessionFactory的使用Bean驗證豆。

org.hibernate.HibernateException:無法獲取默認的Bean驗證工廠

通常它自動加載,如果它是你的類路徑裏面,OK。但是,如果您在Configuration類或XML應用程序dao.xml中定義了一些驗證Bean,則可能會引發一些類似這樣的錯誤。

也許在看看你的applicationContext * .XML應該幫助我們。
也許看看你的pom.xml(如果你正在使用maven)也應該有所幫助。

+0

我添加了類路徑和應用程序上下文 – Tayba

+0

''和''可能會在'webapp-servlet.xml'文件和'applicationContext.xml'文件中聲明兩次。我通常在'webapp-servlet.xml'中設置這些標籤。 – ThierryB

+0

使用在我的配置這些豆:'<豆ID = 「驗證」 類= 「org.springframework.validation.beanvalidation.LocalValidatorFactoryBean」/>'。嘗試添加它作爲默認驗證程序,看看會發生什麼。 – ThierryB

0

檢查您的類路徑: - 你確定驗證-API - 1.0.0.GA.jar在裏面? - 你有沒有與你的庫有衝突?

+0

我已添加類路徑和應用程序上下文 – Tayba