2011-03-11 59 views
0

正在使用Jboss6.x並試圖使休眠春天JNDI數據源的工作..Hibernate3的註解JNDI數據源Spring的配置 - 錯誤

我有我的文件如下。

我得到錯誤:

15:19:11,593 ERROR [ContextLoader] Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/hibernate-config.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) [:3.0.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [:3.0.5.RELEASE] 

任何想法?

休眠-confing.xml ...下面

> <?xml version="1.0" encoding="UTF-8"?> 
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD 
> BEAN//EN" 
> "http://www.springframework.org/dtd/spring-beans.dtd"> 
> <beans> <bean 
> id="hfTransactionManager" 
> class="org.springframework.transaction.jta.JtaTransactionManager"/> 
> <bean id="sessionFactory" 
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
>  <property name="dataSource" 
> ref="hfdataSource"/> 
>  <property name="annotatedClasses">   <list> 
>   <value>com.common.model.User</value> 
>    </list> 
>  </property>  </bean>  <bean id="userDAO" 
> class="com.common.dao.impl.UserDAOImpl"> 
>  <property name="sessionFactory" ref="sessionFactory"/>  </bean> 
> </beans> 

的applicationContext.xml ......下面

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> 
<beans> 
    <import resource="applicationContext-security.xml"/> 
    <!-- JNDI datasource --> 
    <bean id="hfdataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
    <property name="jndiName" value="java:MSSQLDS"/> 
    </bean> 
    <!-- Hibernate stuff --> 
    <import resource="hibernate-config.xml"/> 
</beans> 

回答

0

我覺得你只是有一些庫衝突:Hibernate試圖找到下面的構造:

org.hibernate.validator.ClassValidator(java.lang.Class, 
             java.util.ResourceBundle, 
             org.hibernate.validator.MessageInterpolator, 
             java.util.Map, 
             org.hibernate.annotations.common.reflection.ReflectionManager) 

並沒有找到它。確保您使用的Hibernate驗證器版本與您使用的其他休眠罐兼容。