I am trying to debug the following code in Eclipse 3.0.
The configuration xml exists at "C:/Java/eclipse/workspace/HibernateStores/resources/Test/com.ajcs.hibernatestores.test.TestEvent/Hibernate.cfg.xml"
but it throws a not found exception. The TestEvent.hbm.xml also exists at the path specified and is the same hbm as found in the Event tutorial.
Hibernate version:Hibernate3.jar (3.0)
Code:
//constructor
public HibernateUtil(String cfgPath) {
try {
configuration = new Configuration().configure(cfgPath);
} catch (HibernateException e) {
e.printStackTrace();
}
}
Hibernate.cfg.xml at that locationCode:
<?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-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:data/test</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider
</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="C:/Java/eclipse/workspace/HibernateStores/resources/Test/com.ajcs.hibernatestores.test.TestEvent/TestEvent.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Full stack trace of exceptions:
org.hibernate.HibernateException: C:/Java/eclipse/workspace/HibernateStores/resources/Test/com.ajcs.hibernatestores.test.TestEvent/Hibernate.cfg.xml not found
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1087)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1111)
at com.ajcs.hibernatestores.HibernateUtil.<init>(HibernateUtil.java:83)
at com.ajcs.hibernatestores.test.HibernateStoresTests.testSaveBean(HibernateStoresTests.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Initial SessionFactory creation failed.java.lang.NullPointerException