-->
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: Error parsing hibernate mapping file!!
PostPosted: Wed Sep 22, 2010 10:10 am 
Newbie

Joined: Wed Sep 22, 2010 9:35 am
Posts: 3
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>





Exception

Exception 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


Top
 Profile  
 
 Post subject: Re: Error parsing hibernate mapping file!!
PostPosted: Wed Sep 22, 2010 10:12 am 
Newbie

Joined: Wed Sep 22, 2010 9:35 am
Posts: 3
And this is the hibernate configuration file:
Quote:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.url">jdbc:h2:file:/u1/tmp/disaster_master;MULTI_THREADED=1</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">10</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>

<mapping resource="hibernate/dm_alerts.hbm.xml"/>

</session-factory>

</hibernate-configuration>


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.