Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: null
Caused by: org.hibernate.MappingException: Association references unmapped class: null这是我的配置文件,不知哪里有错误,那位高手给看一下,谢谢!!!
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@127.0.0.1:1521:BYSJ</value>
</property>
<property name="username">
<value>bysj</value>
</property>
<property name="password">
<value>bysj</value>
</property>
</bean>
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>entity/hbm/Academe.hbm.xml</value><!--映射文件路径 -->
<value>entity/hbm/Admin.hbm.xml</value>
<value>entity/hbm/Classes.hbm.xml</value>
<value>entity/hbm/CoachTeacher.hbm.xml</value>
<value>entity/hbm/Committee.hbm.xml</value>
<value>entity/hbm/EchoCondition.hbm.xml</value>
<value>entity/hbm/Proportion.hbm.xml</value>
<value>entity/hbm/Specialty.hbm.xml</value>
<value>entity/hbm/Student.hbm.xml</value>
<value>entity/hbm/SyndicTeacher.hbm.xml</value>
<value>entity/hbm/Task.hbm.xml</value>
<value>entity/hbm/Teacher.hbm.xml</value>
<value>entity/hbm/Topic.hbm.xml</value>
<value>entity/hbm/TopicDemand.hbm.xml</value>
<value>entity/hbm/TopicType.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>
<bean id="academeDAO" class="dao.impl.AcademeDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="adminDAO" class="dao.impl.AdminDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="classesDAO" class="dao.impl.ClassesDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="coachTeacherDAO" class="dao.impl.CoachTeacherDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="committeeDAO" class="dao.impl.CommitteeDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="echoConditionDAO" class="dao.impl.EchoConditionDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="proportionDAO" class="dao.impl.ProportionDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="specialtyDAO" class="dao.impl.SpecialtyDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="studentDAO" class="dao.impl.StudentDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="syndicTeacherDAO" class="dao.impl.SyndicTeacherDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="taskDAO" class="dao.impl.TaskDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="teacherDAO" class="dao.impl.TeacherDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="topicDAO" class="dao.impl.TopicDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="topicDemandDAO" class="dao.impl.TopicDemandDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
</beans>
Caused by: org.hibernate.MappingException: Association references unmapped class: null这是我的配置文件,不知哪里有错误,那位高手给看一下,谢谢!!!
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@127.0.0.1:1521:BYSJ</value>
</property>
<property name="username">
<value>bysj</value>
</property>
<property name="password">
<value>bysj</value>
</property>
</bean>
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>entity/hbm/Academe.hbm.xml</value><!--映射文件路径 -->
<value>entity/hbm/Admin.hbm.xml</value>
<value>entity/hbm/Classes.hbm.xml</value>
<value>entity/hbm/CoachTeacher.hbm.xml</value>
<value>entity/hbm/Committee.hbm.xml</value>
<value>entity/hbm/EchoCondition.hbm.xml</value>
<value>entity/hbm/Proportion.hbm.xml</value>
<value>entity/hbm/Specialty.hbm.xml</value>
<value>entity/hbm/Student.hbm.xml</value>
<value>entity/hbm/SyndicTeacher.hbm.xml</value>
<value>entity/hbm/Task.hbm.xml</value>
<value>entity/hbm/Teacher.hbm.xml</value>
<value>entity/hbm/Topic.hbm.xml</value>
<value>entity/hbm/TopicDemand.hbm.xml</value>
<value>entity/hbm/TopicType.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>
<bean id="academeDAO" class="dao.impl.AcademeDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="adminDAO" class="dao.impl.AdminDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="classesDAO" class="dao.impl.ClassesDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="coachTeacherDAO" class="dao.impl.CoachTeacherDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="committeeDAO" class="dao.impl.CommitteeDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="echoConditionDAO" class="dao.impl.EchoConditionDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="proportionDAO" class="dao.impl.ProportionDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="specialtyDAO" class="dao.impl.SpecialtyDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="studentDAO" class="dao.impl.StudentDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="syndicTeacherDAO" class="dao.impl.SyndicTeacherDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="taskDAO" class="dao.impl.TaskDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="teacherDAO" class="dao.impl.TeacherDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="topicDAO" class="dao.impl.TopicDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="topicDemandDAO" class="dao.impl.TopicDemandDAOImpl">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
</beans>
解决方案 »
- 数组问题求解(急求)
- 数据库连接池怎么和properties文件联合使用,请进
- private static final Log logger = LogFactory.getLog(OrgPanelUI.class);这些是什么意思?
- 急急急!!!jsp实现字典输入
- spring配置文件访问问题,高分求助!!!
- 为什么我用ibatis存储数据的时候会中文乱码?
- 想从事j2ee方面,做个怎样的系统作品才能有点代表性,用来应聘的,新手
- 在java中,如何实现表格那样的界面?比如三行三列怎样实现,用到哪个类?
- 求助~~运行hibernate出现的问题
- 用java运行时出现exception的输入显示
- linux系统运行相同的JAVA程序,在不同电视机上为什么字体大小显示不一样?分辨率设置也一样!
- 请教一个Hibernate left join fetch 问题
<value>entity/hbm/Admin.hbm.xml </value>
<value>entity/hbm/Classes.hbm.xml </value>
<value>entity/hbm/CoachTeacher.hbm.xml </value>
<value>entity/hbm/Committee.hbm.xml </value>
<value>entity/hbm/EchoCondition.hbm.xml </value>
<value>entity/hbm/Proportion.hbm.xml </value>
<value>entity/hbm/Specialty.hbm.xml </value>
<value>entity/hbm/Student.hbm.xml </value>
<value>entity/hbm/SyndicTeacher.hbm.xml </value>
<value>entity/hbm/Task.hbm.xml </value>
<value>entity/hbm/Teacher.hbm.xml </value>
<value>entity/hbm/Topic.hbm.xml </value>
<value>entity/hbm/TopicDemand.hbm.xml </value>
<value>entity/hbm/TopicType.hbm.xml </value>
你看看映射文件中的 class 的路径是不是正确
<value>entity/hbm/Admin.hbm.xml </value>
<value>entity/hbm/Classes.hbm.xml </value>
<value>entity/hbm/CoachTeacher.hbm.xml </value>
<value>entity/hbm/Committee.hbm.xml </value>
<value>entity/hbm/EchoCondition.hbm.xml </value>
<value>entity/hbm/Proportion.hbm.xml </value>
<value>entity/hbm/Specialty.hbm.xml </value>
<value>entity/hbm/Student.hbm.xml </value>
<value>entity/hbm/SyndicTeacher.hbm.xml </value>
<value>entity/hbm/Task.hbm.xml </value>
<value>entity/hbm/Teacher.hbm.xml </value>
<value>entity/hbm/Topic.hbm.xml </value>
<value>entity/hbm/TopicDemand.hbm.xml </value>
<value>entity/hbm/TopicType.hbm.xml </value>
你看看是不是你的class中的路径的问题