I get the following exception when mapping file is parsed.
This is my mapping file:
Quote:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.bfm.app.dmserver.hibernate">
<class name="Alert" table="dm_alerts">
<id name="alertId" type="long" column="alert_id">
<generator class="native"/>
</id>
<property name="groupId" type="long" column="group_id"/>
<property name="alertStatus" type="string" column="status" />
<property name="alertLevel" type="string" column="alert_level" />/>
<property name="alertCreator" type="string" column="alert_creator" />
<property name="owner" type="string" column="owner" />
<property name="description" type="string" column="description" length=""/>
<property name="updateTime" type="java.sql.Timestamp" column="update_time"/>
<property name="createTime" type="java.sql.Timestamp" column="create_time"/>
<property name="client" type="string" column="client" />
<property name="dataCenter" type="string" column="data_center" />
<property name="host" type="string" column="host" />
<property name="elevation" type="string" column="elevation" />
<property name="server" type="string" column="server" />
<property name="networkSegment" type="string" column="network_segment" />
<property name="enterpriseService" type="string" column="enterprise_service" />
<property name="application" type="string" column="application" />
</class>
</hibernate-mapping>
ExceptionException in thread "main" java.lang.ExceptionInInitializerError
at com.bfm.app.dmserver.hibernate.HibernateSessionFactory.initialize(HibernateSessionFactory.java:29)
at com.bfm.app.dmserver.hibernate.HibernateSessionFactory.<init>(HibernateSessionFactory.java:18)
at com.bfm.app.mi6server.main.Main.main(Main.java:28)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource hibernate/dm_alerts.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1679)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
at com.bfm.app.dmserver.hibernate.HibernateSessionFactory.initialize(HibernateSessionFactory.java:25)
... 2 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:604)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
... 8 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:601)
... 9 more
ERROR 22-09-2010-09:53:44,810 [main] org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(27) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".
ERROR 22-09-2010-09:53:44,813 [main] com.bfm.app.mi6server.http.HTMLRetriever - Initial SessionFactory creation failed.Could not parse mapping document from resource hibernate/dm_alerts.hbm.xml
org.hibernate.InvalidMappingException: Could not parse mapping document from resource hibernate/dm_alerts.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1679)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
at com.bfm.app.dmserver.hibernate.HibernateSessionFactory.initialize(HibernateSessionFactory.java:25)
at com.bfm.app.dmserver.hibernate.HibernateSessionFactory.<init>(HibernateSessionFactory.java:18)
at com.bfm.app.mi6server.main.Main.main(Main.java:28)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:604)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
... 8 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:601)
... 9 more