java - HibernateException "Could not parse configuration: hibernate.cfg.xml" error while running a simple Hibernate Application -


log4j:warn no appenders found logger (org.hibernate.cfg.environment). log4j:warn please initialize log4j system properly. exception in thread "main" org.hibernate.hibernateexception: not parse configuration: hibernate.cfg.xml     @ org.hibernate.cfg.configuration.doconfigure(configuration.java:1491)     @ org.hibernate.cfg.configuration.configure(configuration.java:1425)     @ com.javatpoint.mypackage.storedata.main(storedata.java:13) caused by: org.dom4j.documentexception: connection refused: connect nested exception: connection refused: connect     @ org.dom4j.io.saxreader.read(saxreader.java:484)     @ org.hibernate.cfg.configuration.doconfigure(configuration.java:1481)     ... 2 more 

why hibernateexception occur?

this caused because of referencing dtd on top of hibernate.cfg.xml not present in hibernate jar using.

assuming not using hibernate version 2.0, check in hibernate.cfg.xml have on top:

<!doctype hibernate-configuration public         "-//hibernate/hibernate configuration dtd 3.0//en"         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> 

and in case using xml hbm files entity mapping in xml files have on top:

<!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> 

Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -