Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Exception - org.hibernate.MappingException: Could not read mappings from resource

Posted on 2006-10-30
Last Modified: 2012-08-13
My Directory Structure is

proj -> src -> hibernate.cfg.xml, TbPROJFunctional.hbm.xml, HSSFData.java
when I try to run HSSFData.java I am getting below exception. can you tll what would be the directory structure
and how to get remove the exception

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
org.hibernate.MappingException: Could not read mappings from resource: TbPROJFunctional.hbm.xml
      at org.hibernate.cfg.Configuration.addResource(Configuration.java:484)
      at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1453)
      at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1421)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1402)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1378)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1298)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1284)
      at HSSFData.insertData(HSSFData.java:76)
      at HSSFData.setData(HSSFData.java:65)
      at HSSFSheet.main(HSSFSheet.java:150)
Caused by: org.hibernate.PropertyNotFoundException: field not found: CONTACT
      at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:97)
      at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:104)
      at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:112)
      at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:89)
      at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
      at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:276)
      at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2131)
      at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2108)
      at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1998)
      at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:361)
      at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:275)
      at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:146)
      at org.hibernate.cfg.Configuration.add(Configuration.java:385)
      at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:426)
      at org.hibernate.cfg.Configuration.addResource(Configuration.java:481)
      ... 9 more
Question by:basirana

Accepted Solution

kannan_ekanath earned 500 total points
ID: 17840387
org.hibernate.PropertyNotFoundException: field not found: CONTACT

The above is clear enough? Your hbm declares a property called CONTACT but it is not found in HSSFData.java. I assume HSSFData is your own class. Fix the hbm / java file as the case may be :)
LVL 92

Expert Comment

ID: 17841120
it needs a getCONTACT method by the looks

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 40
Java program running SQL query 5 37
Need Help! Getting a syntax error and don't understand why 3 31
Java Eclipse Loop 3 20
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question