복붙노트

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

SPRING

java.lang.ClassNotFoundException : org.hibernate.engine.SessionFactoryImplementor

최대 절전 모드 4.1.0으로 마이그레이션하려고합니다. 최종 버전 3.1.1.RELEASE 다음은 최대 절전 모드 구성입니다.

    <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" />

하지만 응용 프로그램을 실행하려고하면 다음과 같은 예외가 발생합니다.

 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)

왜이 오류가 발생했는지, 어떻게 고칠 수 있는지 조언 해주십시오. 감사합니다.

해결법

  1. ==============================

    1.org.springframework.orm.hibernate4.HibernateTransactionManager를 사용해보십시오.

    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>
    
  2. from https://stackoverflow.com/questions/9908452/java-lang-classnotfoundexception-org-hibernate-engine-sessionfactoryimplementor by cc-by-sa and MIT license