我正在编写一个java模块,其中我使用了hibernate验证器。该模块本身工作正常。
然而,当它作为父项目的一部分包含在内,它使用hibernate作为标准实体映射作为ORM时,父模块因为抱怨它无法设置验证工厂而失败(因此无法设置会话厂)。
异常消息是“调用init方法失败;嵌套异常是org.hibernate.HibernateException:无法获取默认Bean验证工厂”
-Pulkit
编辑: hibernate-validator:4.3.1.Final hibernate-core:3.6.5
Stacktrace:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'messageSourceServiceTarget' defined in class
path resource [applicationContext-service.xml]: Cannot resolve
reference to bean 'mutableResourceBundleMessageSource' while setting
bean property 'activeMessageSource'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'mutableResourceBundleMessageSource' defined
in class path resource [applicationContext-service.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor#0'
defined in class path resource [applicationContext-service.xml]:
Cannot resolve reference to bean 'transactionInterceptor' while
setting bean property 'transactionInterceptor'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionInterceptor' defined in class path
resource [applicationContext-service.xml]: Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in class path
resource [applicationContext-service.xml]: Cannot resolve reference to
bean 'sessionFactory' while setting bean property 'sessionFactory';
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'sessionFactory' defined in class path
resource [applicationContext-service.xml]: Invocation of init method
failed; nested exception is org.hibernate.HibernateException: Unable
to get the default Bean Validation factory