-->
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: org.hibernate.MappingException: invalid configuration
PostPosted: Mon Apr 03, 2006 8:14 am 
Newbie

Joined: Mon Apr 03, 2006 7:59 am
Posts: 1
Location: Chennai, INDIA
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

I'm just following the reference manuals... My problem is after executing the eventmanager class igot the error... i cannot get the sql statements as given in the manual... I'm using MySQL database..

Hibernate version:
hibernate 3.1
Mapping documents:
<!DOCTYPE hibernate-configuration PUBLIC

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">



<hibernate-configuration>

<session-factory>

<property name="show_sql">true</property>

<mapping resource="events/Events.hbm.xml"/>


<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>

<property name="connection.url">
jdbc:mysql://192.9.200.63:3306/test
</property>

<property name="connection.username">
root
</property>

<property name="connection.password">
</property>

<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>


</session-factory>

</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Events theEvent = new Events();
theEvent.setTitle(title);
theEvent.setDate(theDate);
session.save(theEvent);
session.getTransaction().commit();

Full stack trace of any exception that occurs:
[java] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[java] log4j:WARN Please initialize the log4j system properly.
[java] Initial SessionFactory Creation failed...org.hibernate.MappingException: invalid configuration
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at util.HibernateUtil.<clinit>(Unknown Source)
[java] at events.EventManager.CreateAndStoreEvent(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Caused by: org.hibernate.MappingException: invalid configuration
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1347)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1288)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1274)
[java] ... 3 more
[java] Caused by: org.xml.sax.SAXParseException: The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
[java] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
[java] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
[java] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
[java] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
[java] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2048)
[java] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
[java] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
[java] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
[java] at org.dom4j.io.SAXReader.read(SAXReader.java:465)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1344)
[java] ... 5 more
[java] Java Result: 1


Name and version of the database you are using:
mysql5.0.11 beta

The generated SQL (show_sql=true):
No sql statements are generated

Debug level Hibernate log excerpt:
How to get the hibernate log excerpt? i have no idea on that???

_________________
R VIJAY,
Project Engineer,
CDAC,
Chennai.
rvijaycool@yahoo.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 8:48 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Quote:
[java] Caused by: org.xml.sax.SAXParseException: The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".


Order is important. Your <property>s must all come before your <mapping>s. You need to reorder things.

_________________
nathan


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.