Quote:
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Initial sessionfactory creation failed....sridharorg.hibernate.HibernateException: Could not find datasource
java.lang.ExceptionInInitializerError
This means hibernate is not able to find the datasource which you have specified in the hibernate.cfg.xml file. I think there is one entry in ur cfg xml like:
Code:
<property
name="connection.datasource">DataSource4Hiber</property>
Make sure DataSource4Hiber datasource is available with the app server and that is the right jndi name of the datasource.
If you dont want to use a DS then just remove that property from cfg.xml and specify the connection parameters like:
Code:
<!-- Database connection settings -->
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="connection.url">
jdbc:oracle:thin:@localhost:1521:XE
</property>
<property name="connection.username">hr</property>
<property name="connection.password">hr</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>