java - Hibernate issue with using http://www.hibernate.org/dtd -
this question has answer here:
- can't parse hibernate.cfg.xml while offline 13 answers
i'm using http://hibernate.sourceforge.net namespace in hibernate configuration files gives me these warnings:
recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. use namespace http://www.hibernate.org/dtd/ instead. refer hibernate 3.6 migration guide!
so tried switching hibernate.cfg.xml , other *.hbm.xml files using http://www.hibernate.org/dtd. when try generate code using hibernate tools in eclipse following error message (code generation works fine other namespace):
org.hibernate.hibernateexception: not parse configuration: c:\dev\workspace\dataload\hibernate.cfg.xml not parse configuration: c:\dev\workspace\dataload\hibernate.cfg.xml
org.dom4j.documentexception: www.hibernate.org nested exception: www.hibernate.org www.hibernate.org nested exception: www.hibernate.org org.dom4j.documentexception: www.hibernate.org nested exception: www.hibernate.org www.hibernate.org nested exception: www.hibernate.org
here's hibernate.cfg.xml:
<?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- database connection settings --> <property name="connection.driver_class"> com.mysql.jdbc.driver </property> <property name="connection.url"> jdbc:mysql://localhost:3306/findata?tcpkeepalive=true </property> <property name="connection.username">root</property> <property name="connection.password">xxxxxxxx</property> <property name="connection.pool_size">2</property> <property name="show_sql">true</property> <property name="dialect"> org.hibernate.dialect.mysqldialect </property> <property name="current_session_context_class">thread</property> <property name="cache.provider_class"> org.hibernate.cache.nocacheprovider </property> <mapping resource="conf/alert.hbm.xml" /> <mapping resource="conf/entity.hbm.xml" /> <mapping resource="conf/factdata.hbm.xml" /> <mapping resource="conf/timeevent.hbm.xml" /> <mapping resource="conf/user.hbm.xml" /> <mapping resource="conf/alerttarget.hbm.xml" /> <mapping resource="conf/logalert.hbm.xml" /> <mapping resource="conf/repeattype.hbm.xml" /> <mapping resource="conf/schedule.hbm.xml" /> <mapping resource="conf/task.hbm.xml" /> <mapping resource="conf/jobqueue.hbm.xml" /> <mapping resource="conf/logtask.hbm.xml" /> <mapping resource="conf/exclude.hbm.xml" /> <mapping resource="conf/lognotification.hbm.xml" /> <mapping resource="conf/job.hbm.xml" /> <mapping resource="conf/metric.hbm.xml" /> <mapping resource="conf/entitygroup.hbm.xml" /> <mapping resource="conf/extractsingle.hbm.xml" /> </session-factory> </hibernate-configuration>
we had problems parsing hibernate cfg files in last time. root of cause hibernate site unreachable. after googling , debugging org.hibernate.util.dtdentityresolver class, realized there way, how specify dtd url:
<!doctype hibernate-configuration system "classpath://org/hibernate/hibernate-configuration-3.0.dtd"> this means hibernate load dtd classpath - included in hibernate jar in org/hibernate directory.
however, use hibernate 3.5.6 - don't hnow if approach still works in newer version - give try. benefit of independent on internet connection, proxies , on.
Comments
Post a Comment