<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="connection.username">scott</property>
<property name="connection.url">
jdbc:oracle:thin:@127.0.0.1:1521:orcl
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="myeclipse.connection.profile">local</property>
<property name="connection.password">tiger</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<mapping resource="com/stuman/domain/Course.hbm.xml" />
<mapping resource="com/stuman/domain/Admin.hbm.xml" />
<mapping resource="com/stuman/domain/Student.hbm.xml" />
<mapping resource="com/stuman/domain/Score.hbm.xml" /> </session-factory></hibernate-configuration>
运行时报错java.lang.NoClassDefFoundError或者java.lang.ExceptionInInitializerError
还有com.stuman.dao.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:19)
com.stuman.struts.action.LoginAction.execute(LoginAction.java:43)
查看网上资料,多是配置hibernate.cfg.xml的问题,不知道这个文件应该配在哪里?
调用sessionFactory = new Configuration().configure().buildSessionFactory();
默认路径是哪呀?
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="connection.username">scott</property>
<property name="connection.url">
jdbc:oracle:thin:@127.0.0.1:1521:orcl
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="myeclipse.connection.profile">local</property>
<property name="connection.password">tiger</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<mapping resource="com/stuman/domain/Course.hbm.xml" />
<mapping resource="com/stuman/domain/Admin.hbm.xml" />
<mapping resource="com/stuman/domain/Student.hbm.xml" />
<mapping resource="com/stuman/domain/Score.hbm.xml" /> </session-factory></hibernate-configuration>
运行时报错java.lang.NoClassDefFoundError或者java.lang.ExceptionInInitializerError
还有com.stuman.dao.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:19)
com.stuman.struts.action.LoginAction.execute(LoginAction.java:43)
查看网上资料,多是配置hibernate.cfg.xml的问题,不知道这个文件应该配在哪里?
调用sessionFactory = new Configuration().configure().buildSessionFactory();
默认路径是哪呀?
<mapping resource="com/stuman/domain/Admin.hbm.xml" />
<mapping resource="com/stuman/domain/Student.hbm.xml" />
<mapping resource="com/stuman/domain/Score.hbm.xml" />
有这4个文件么,这些个文件分别对应这一个Class,你有定义这些class吗?