Hibernate.cfg.xml problem - not able to run the java project
BhanuChandar Challa
Greenhorn
Joined: Nov 05, 2012
Posts: 7
posted
0
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">
How are you building your application? Where does the .class files resides? Put your configuration file directly inside the 'src' folder.
I would suggest you to please go though the link provided earlier along with the this Google.
Thanks.
BhanuChandar Challa
Greenhorn
Joined: Nov 05, 2012
Posts: 7
posted
0
I am very new to java envi, so please igonre my mistakes.
---------------------------------------------------------------------
After i moving hibernate.cfg.xml file to src location, I got below the new error.
Nov 05, 2012 4:36:50 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Nov 05, 2012 4:36:50 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.8.Final}
Nov 05, 2012 4:36:50 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Nov 05, 2012 4:36:50 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Nov 05, 2012 4:36:50 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Nov 05, 2012 4:36:50 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Nov 05, 2012 4:36:51 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Nov 05, 2012 4:36:51 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org.javabrains.chandu.dto.UserDetails
Exception in thread "main" org.hibernate.MappingNotFoundException: resource: org.javabrains.chandu.dto.UserDetails not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:728)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2115)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2087)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2067)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2020)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1935)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1914)
at org.chandu.hibernate.HibernateTest.main(HibernateTest.java:21)