Please Help me in below the issue.
I have tried to create a simple
java project which will store the UserDetails data into the PostgreSQL database by using Hibernate.
But i am getting the below error when i tried to run the application.
CONSOLE:
-------------------------------------------------------------------------------------------
Nov 05, 2012 3:21:28 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Nov 05, 2012 3:21:28 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.8.Final}
Nov 05, 2012 3:21:28 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Nov 05, 2012 3:21:28 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Nov 05, 2012 3:21:28 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Nov 05, 2012 3:21:28 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Exception in
thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1953)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1934)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1914)
at org.chandu.hibernate.HibernateTest.main(HibernateTest.java:21)
---------------------------------------------------------------------------------------------------------------
My hibernate.cfg.xml file is:
---------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.url">dbc:postgresql://localhost:5432/hibernatedb</property>
<property name="connection.username">postgres</property>
<property name="connection.password">chandu</property>
<!--
JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">Create</property>
<mapping resource="org.javabrains.chandu.dto.UserDetails"/>
</session-factory>
</hibernate-configuration>
-----------------------------------------------------------------------------------------------------------------------
I am using hibernate 4.1.8 for this project. If it is the problem with <!DOCTYPE element in hibernate.cfg.xml, Please help me to edit it.
Thanks in Advance,
Bhanu Chandar.