-->
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.  [ 8 posts ] 
Author Message
 Post subject: problem with loading the XXX.hbm.xml files
PostPosted: Sat Feb 14, 2004 4:15 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:27 am
Posts: 33
in dir: \com\hibernate\trial\ place files: People.hbm.xml , People.class
Try.class(main class)
when i run Try class err shows:

Feb 15, 2004 5:53:03 PM net.sf.hibernate.cfg.Configuration addFile
SEVERE: Could not configure datastore from file: People.hbm.xml
java.net.MalformedURLException: People.hbm.xml (The system cannot find the file
specified)
at org.dom4j.io.SAXReader.read(SAXReader.java:221)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:169)
at com.hibernate.trial.Try.main(Try.java:12)
Exception in thread "main" net.sf.hibernate.MappingException: java.net.Malformed
URLException: People.hbm.xml (The system cannot find the file specified)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:176)
at com.hibernate.trial.Try.main(Try.java:12)
Caused by: java.net.MalformedURLException: People.hbm.xml (The system cannot fin
d the file specified)
at org.dom4j.io.SAXReader.read(SAXReader.java:221)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:169)
... 1 more
\\\\\\\\\\
my Try.class code:
public static void main(String[] args)throws Exception{
Configuration cfg=new Configuration()
.addFile("People.hbm.xml");
SessionFactory sessions=cfg.buildSessionFactory();
Session sess=sessions.openSession();
Transaction tx=sess.beginTransaction();

where did the problem come from?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 5:19 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You have trivial classloading/classpath problems to solve, we can't help you here.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 5:41 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:27 am
Posts: 33
i change the Try.class code
............
Configuration cfg=new Configuration()
.addClass(com.hibernate.trial.People.class);
..............

another problem comes up:
Feb 15, 2004 7:09:13 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
Feb 15, 2004 7:09:13 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Feb 15, 2004 7:09:13 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.ehcache.hibernate.Provider
Exception in thread "main" net.sf.hibernate.HibernateException: could not instan
tiate CacheProvider: net.sf.ehcache.hibernate.Provider
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.ja
va:133)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1
119)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.
java:748)
at com.hibernate.trial.Try.main(Try.java:14)
Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.hibernate.Provider
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)...........

is that mean something wrong with the configuation ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 5:47 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:27 am
Posts: 33
in my hibernation.properties the cache implementaion shows(default)
hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider

does that mean i should change it to net.sf.ehcache.hibernate.provider?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 5:50 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please, read the "step by step" tutorial here:

http://www.hibernate.org/152.html

It also helps if you read at least the first chapter of the reference documentation.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 6:09 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:27 am
Posts: 33
i didn't use tomcat i have it all standalone
all jar file needed have been put to the classpath
and i have read the first 3 chapter of the reference
but still didn't kown get what's wrong,


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 6:13 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You don't need ehcache.jar if your cache provider is not set to EHCache. Check if this is really not the case, maybe an old hibernate.properties file somwhere or a hibernate.cfg.xml.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2004 7:17 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:27 am
Posts: 33
i solved all the problems
thank you so much!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.