Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Object Relational Mapping
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mappin
naveen kumar garg
Greenhorn
Posts: 1
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
when i am trying to execute my application getting this error. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource employee.hbm.xml Exception in thread "main" java.lang.ExceptionInInitializerError at naveen.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:18) at naveen.hibernate.EmployeeTestCase.main(EmployeeTestCase.java:9) Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource employee.hbm.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:602) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1621) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1589) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1568) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542) at org.hibernate.cfg.Configuration.configure(Configuration.java:1462) at org.hibernate.cfg.Configuration.configure(Configuration.java:1448) at naveen.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13) ... 1 more Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:535) at org.hibernate.cfg.Configuration.addResource(Configuration.java:599) ... 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*,resultset*,(query|sql-query)*)". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.dom4j.io.SAXReader.read(SAXReader.java:465) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:532) ... 9 more
my employee.hbm.xml file details
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="naveen.hibernate.Employee" table="employee_details"> <id name="empNo" type="int" column="empno"> <generator class="increment"/> </id> <property name="name" column="name"/> <discriminator column="type" type = "string"/> <subclass name="HourlyEmployee" discriminator-value="hourly"> <property name="maxHourPerDay" column = "max_hour_per_day"/> <property name="hourlyRate" column = "hourly_rate"/> </subclass> <subclass name = "SalariesEmployee" discriminator-value="salaries"> <property name="annualSalary" column = "annual_salary"/> </subclass> </class> </hibernate-mapping>
hibernate.cfg.xml file
<?xml version="1.0" encoding="UTF-8"?> <!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="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/santosh</property> <property name="hibernate.connection.username">root</property> <property name="connection.password">naveen</property> <property name="connection.pool_size">10</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <!-- <property name="show_sql">true</property> <property name="hbm2ddl.auto"></property> --> <mapping resource="employee.hbm.xml"/> </session-factory> </hibernate-configuration>
thanks
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Invalid mapping exception in Hibernate
Hibernate table per class hierarchy
Hibernate table per class hierarchy
Invalid Mapping Exception while inserting data through hibernate
class not found exception while running my first hebernate example
More...