-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Configuration root element doesn't match DOCTYPE?
PostPosted: Tue Mar 30, 2004 5:15 pm 
Newbie

Joined: Tue Feb 24, 2004 6:07 pm
Posts: 4
Hiya.

I'm trying to get to square one with Hibernate, but keep running into an error that claims that my hibernate configuration is bogus:

Quote:
INFO - Hibernate 2.1.1
INFO - hibernate.properties not found
INFO - using CGLIB reflection optimizer
INFO - configuring from file: for-testing-hibernate.cfg.xml
ERROR - Error parsing XML: for-testing-hibernate.cfg.xml(6) Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-configuration".
ERROR - Error parsing XML: for-testing-hibernate.cfg.xml(17) The content of element type "session-factory" must match "(property*,mapping+,(class-cache|collection-cache|jcs-class-cache|jcs-collection-cache)*)".
ERROR - Error parsing XML: for-testing-hibernate.cfg.xml(19) The content of element type "hibernate-configuration" must match "(session-factory)".
ERROR - problem parsing configurationfor-testing-hibernate.cfg.xml
net.sf.hibernate.MappingException: invalid configuration
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:902)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:879)


I'm mystified. Lines like Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-configuration". seem kind of daft. I've tried configurations pulled directly from the site, as well as the one that I want to use:

Quote:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:testdata/test</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>

<property name="dialect">net.sf.hibernate.dialect.HSQLDialect</property>
<property name="show_sql"> true </property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.hbm2ddl.auto">update</property>

<property name="hibernate.connection.pool_size">3</property>

<mapping resource="com/ambientdevices/wine/database/PersistentState.hbm.xml"/>

</session-factory>

</hibernate-configuration>


...all the errors seem to be addressed in this. I realize this is just an XML parsing problem, nothing specifically Hibernate, but has anyone seen anything like this?

Thanks,
- Ert Dredge


Top
 Profile  
 
 Post subject: Error parsing hibernate.cfg.xml
PostPosted: Mon Aug 09, 2004 8:10 am 
Newbie

Joined: Tue Jun 29, 2004 9:35 am
Posts: 6
I've been getting the same problem, is there a simple solution? I've checked and my document appears to be wellformed and valid, so I'm at a loss as to what the problem could be.
hibernate.cfg.xml looks like this

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration
   PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
   <session-factory>
      <property name="connection.url">jdbc:oracle:thin:@SUPPLIER-ORACLE:1521:b2blive</property>
      <property name="connection.username">blah</property>
      <property name="connection.password">blah</property>
      <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
      <property name="show_sql">true</property>
      <property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
      <property name="hibernate.cglib.use_reflection_optimizer">false</property>


      <mapping resource="b2b/deliverybooking/hibernate/DeliveryDock.hbm.xml" />
      <mapping resource="b2b/deliverybooking/hibernate/Booking.hbm.xml" />
      <mapping resource="b2b/deliverybooking/hibernate/BookedOrder.hbm.xml" />
      <mapping resource="b2b/deliverybooking/hibernate/BookedOrderLine.hbm.xml" />
      <mapping resource="b2b/deliverybooking/hibernate/DockMerchandise.hbm.xml" />
      <mapping resource="b2b/deliverybooking/hibernate/OpenTime.hbm.xml" />
      <mapping resource="b2b/deliverybooking/hibernate/serialized/BookingRequestWrapper.hbm.xml" />
   </session-factory>
</hibernate-configuration>


The error produced is

[schemaexport] (<clinit>:462) - Hibernate 2.1.4
[schemaexport] (<clinit>:491) - hibernate.properties not found
[schemaexport] (<clinit>:522) - using CGLIB reflection optimizer
[schemaexport] (configure:906) - configuring from file: hibernate.cfg.xml
[schemaexport] (error:48) - Error parsing XML: C:\B2B\DeliveryBooking\build\bin\hibernate.cfg.xml(5) Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-configuration".
[schemaexport] (error:48) - Error parsing XML: C:\B2B\DeliveryBooking\build\bin\hibernate.cfg.xml(23) The content of element type "session-factory" must match "(property*,mapping+,(class-cache|collection-cache|jcs-class-cache|jcs-collection-cache)*)".
[schemaexport] (error:48) - Error parsing XML: C:\B2B\DeliveryBooking\build\bin\hibernate.cfg.xml(24) The content of element type "hibernate-configuration" must match "(session-factory)".
[schemaexport] (doConfigure:934) - problem parsing configurationC:\B2B\DeliveryBooking\build\bin\hibernate.cfg.xml
[schemaexport] net.sf.hibernate.MappingException: invalid configuration
[schemaexport] at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:931)
[schemaexport] at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:908)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:186)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:301)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[schemaexport] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[schemaexport] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[schemaexport] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[schemaexport] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[schemaexport] Caused by: org.xml.sax.SAXParseException: Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-configuration".
[schemaexport] at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1318)
[schemaexport] at org.apache.xerces.validators.dtd.DTDValidator.reportRecoverableXMLError(DTDValidator.java:1602)
[schemaexport] at org.apache.xerces.validators.dtd.DTDValidator.rootElementSpecified(DTDValidator.java:576)
[schemaexport] at org.apache.xerces.framework.XMLParser.callStartElement(XMLParser.java:1903)
[schemaexport] at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:980)
[schemaexport] at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
[schemaexport] at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1208)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:339)
[schemaexport] at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:930)
[schemaexport] ... 13 more

BUILD FAILED..\SupplierWeb\generic-module-build.xml:118: Schema text failed: problem parsing configuration C:\B2B\DeliveryBooking\build\bin\hibernate.cfg.xml


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.