Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j error

 
megha kanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to run a simple hibernate example and getting this error...
-------------------------------------------------
log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
net.sf.hibernate.MappingException: Error reading resource: eg/otm2/business/Blog.hbm.xml
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:357)
at eg.otm2.test.SchemaTest.exportTables(SchemaTest.java:51)
at eg.otm2.test.SchemaTest.main(SchemaTest.java:63)
Caused by: net.sf.hibernate.MappingException: Associated class not found
at net.sf.hibernate.cfg.Binder.bindOneToMany(Binder.java:719)
at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:552)
at net.sf.hibernate.cfg.Binder$4.create(Binder.java:1448)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1028)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:354)
... 2 more
Caused by: java.lang.ClassNotFoundException: eg.blog.business.BlogItem
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
at net.sf.hibernate.cfg.Binder.bindOneToMany(Binder.java:714)
... 10 more
--------------------------------

I have added the log4j.properties as well in the class path and the Blog.hbm.xml file is also there. I checked the jar files as well. None of the file is missing but dont know where is the error.

Pls help me.

thx
Megha
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think you have two errors here:
first the log4j.properties can not be found (are you sure it is on the classpath ?) and your Blog mapping file can not be found.

make sure the mapping file is contained in the correct directory hierarchy (e.g. in classes/eg/otm2/business/Blog.hbm.xml)


pascal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic