Configuration conf = new Configuration().configure();为什么抛出Exception in thread "main" java.lang.NoClassDefFoundError: 啊?
Configuration conf = new Configuration().configure();抛出异常
Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/DocumentException
刚学hibernante eclipse建的web工程 lib目录下复制了hibernate3.jar包
hibernate.cfg.xml配置文件如下:
<?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">
<!--上面四行对所有的Hibernate连接匹配值文件都相同 -->
<!--hibernate-configuration是连接配置文件的根元素 -->
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connetion.url">jdbc:mysql://localhost/hibernate</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<!-- C3PO connection pool -->
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.timeout">5000</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">true</property>
<!-- 指定数据库方言 -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 根据需要创建数据库 -->
<property name="hbm2dd1.auto">create</property>
<!-- 罗列所有的映射文件 -->
<mapping resource="News.hbm.xml"/>
</session-factory>
</hibernate-configuration>
News.hbm.xml映射文件内容:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--上面四行对所有的Hibernate映射文件都相同 -->
<!--hibernate-mapping是映射文件的根元素 -->
<hibernate-mapping package="tmp">
<!-- 每个CLASS元素对应一个持久化对象PO -->
<class name="News" table="news_table">
<!-- id元素定义持久化类的标示属性 -->
<id name="id" unsaved-value="null">
<generator class="identity" />
</id>
<!-- property元素定义常规属性 -->
<property name="title" />
<property name="content" />
</class>
</hibernate-mapping>
高手帮帮忙,哪里有问题呀?