java.lang.ClassNotFoundException:org.hibernate.engine.SessionFactoryImplementor [英] java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor

查看:154
本文介绍了java.lang.ClassNotFoundException:org.hibernate.engine.SessionFactoryImplementor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用 spring 3.1.1.RELEASE
迁移到hibernate 4.1.0.Final ,以下是我对hibernate的配置:

i am trying to migrate to hibernate 4.1.0.Final with spring 3.1.1.RELEASE and following is my configuration for hibernate:

    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="${project.groupId}.domain" />


    <!-- control the behavior of Hibernate at runtime,All are optional and 
        have reasonable default values -->
    <property name="hibernateProperties">
        <value>
            <!-- hibernate.dialect: allows Hibernate to generate SQL optimized for 
                a particular relational database -->
            hibernate.dialect=org.hibernate.dialect.MySQLDialect
            hibernate.hbm2ddl.auto=create-drop
            hibernate.show_sql=false
            hibernate.jdbc.fetch_size=100
            hibernate.jdbc.batch_size=100
            hibernate.jdbc.batch_versioned_data=true
            hibernate.order_inserts=true
            hibernate.order_updates=true
            hibernate.cache.use_query_cache=false
            hibernate.cache.use_second_level_cache=false

        </value>
    </property>


</bean>

<!-- provides properties to hibernate to make it able to create session 
    factory. Hibernate uses instance of session bean of type -->
<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">

    <property name="driverClassName" value="com.mysql.jdbc.Driver" />

    <property name="url" value="${db.url}" />

    <property name="username" value="${db.username}" />

    <property name="password" value="${db.password}" />

</bean>

<!-- responsible for creating sessionFactory opening transactions and binding 
    them to the current thread context. -->
<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    <property name="nestedTransactionAllowed" value="true" />
</bean>

<!-- get exception translation from HibernateException into DataAccessException 
    hierarchy -->
<bean
    class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

但是当试图运行应用程序时,我得到以下异常:

but when trying to run the application, i got the following exception:

 java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)

请告诉我为什么我得到这个错误,以及如何解决它,谢谢。

please advise why i get this error, and how to fix it, thanks.

推荐答案

code> org.springframework.orm.hibernate4.HibernateTransactionManager

Try using the org.springframework.orm.hibernate4.HibernateTransactionManager

    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="dataSource" ref="dataSource" />
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

这篇关于java.lang.ClassNotFoundException:org.hibernate.engine.SessionFactoryImplementor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆