Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.Configuration]

解决方案 »

  1.   

    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg,自己百度下。
      

  2.   

    这是我的application.xml文件
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> </bean>

    <bean id="sessionFactory1"> <!--sessionFactory  bean 对象,关联 dataSource 数据源对象,通过  关联-->
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    <property name="jdbcExceptionTranslator">
    <ref bean="jdbcExceptionTranslator" />
    </property> <property name="hibernateProperties">
    <props>
     <!--方言 -->
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.cglib.use_reflection_optimizer"> true</prop>
    <prop key="hibernate.connection.isolation">4</prop>
    </props>
    </property> <!--在此添加O-R映射文件 -->
    <property name="mappingResources">
    <list>
    <value>com/bean/Actsend.hbm.xml</value>
    <value>com/bean/Admin.hbm.xml</value>
    <value>com/bean/Bookedit.hbm.xml</value>
    <value>com/bean/Course.hbm.xml</value>
    <value>com/bean/Gradegl.hbm.xml</value>
    <value>com/bean/Hwcheck.hbm.xml</value>
    <value>com/bean/Other.hbm.xml</value>
    <value>com/bean/Prize.hbm.xml</value>
    <value>com/bean/Teacher.hbm.xml</value>
    </list>
    </property> 
    </bean>
      

  3.   

    我猜由改了因为加载不了不是说applicationContext.xml不能加载SessionFactory类我就把它改为这样了
    <!-- 根据数据源,创建数据库连接对象的工厂类 -->
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="configLocation"
    value="classpath:hibernate.cfg.xml">

    </property>
    </bean>还是不能加载