小弟在用hibernate自带的SchemaExport 生成表时,出错,目前还没差出来,用的是Hibernate 3.2.6 oracle10.20 jdk5.0
驱动都加进去了,请高手帮忙看下,我在网上也没找到具体的原因,小弟实在没分了,请见谅,以后不上,谢谢 错误信息:
19:30:07,640  INFO Environment:514 - Hibernate 3.2.6
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.hibernate.cfg.Configuration.reset(Configuration.java:174)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:193)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:197)
at com.dvnchina.boss.ExportDB.main(ExportDB.java:14)
Caused by: java.lang.NullPointerException
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:144)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:529)
... 4 more
配置文件及源码在下:
hibernate.hbm.xml
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">
jdbc:oracle:thin:@localhost:1521:orcl
</property>
<property name="hibernate.connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.connection.password">tiger</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="show_sql">true</property>
<mapping resource="com/dvnchina/boss/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
User.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.dvnchina.boss.User" table="t_user">
<id name="id">
<generator class="uuid"></generator>
</id>
<property name="username"></property>
<property name="password"></property>
<property name="age"></property>
<property name="address"></property>
</class>
</hibernate-mapping>ExportDB.javapublic class ExportDB { public static void main(String[] args) {

//读取配置文件
Configuration cfg = new Configuration().configure();

//创建SchemaExport对象
SchemaExport export = new SchemaExport(cfg);

//创建数据库表
export.create(true,true);
}}