-->
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.  [ 9 posts ] 
Author Message
 Post subject: Cannot load XML configuration file
PostPosted: Mon Sep 13, 2004 11:40 am 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
I have a small test project, it contains what appear to be identical property files, one "hibernate.properties" and one "hibernate.xfg.xml". When I run SchemaUpdate with --properties everything is ok, when I run it with --config I get an error that the file cannot be found. I have tried using a fully-qualified path and still get the error. Any suggestions anyone?

Hibernate version: 2.1.6

Full stack trace of any exception that occurs:

Sep 13, 2004 11:31:59 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
Sep 13, 2004 11:31:59 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.ihost.cs.jdbc.CloudscapeDriver, hibernate.default_schema=real
life, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.DerbyDialect, hibernate.connection.username=sa, hibernate.connection.url=jdbc:cloudscape:d:/My Projects/RealLife/RealLife, hibernate.show_sql=true, hibernate.connection.password=, hibernate.connection.pool_size=2}
Sep 13, 2004 11:31:59 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Sep 13, 2004 11:31:59 AM net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: hibernate.cfg.xml
Sep 13, 2004 11:31:59 AM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: hibernate.cfg.xml
Sep 13, 2004 11:31:59 AM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
WARNING: hibernate.cfg.xml not found
Sep 13, 2004 11:31:59 AM net.sf.hibernate.tool.hbm2ddl.SchemaUpdate main
SEVERE: Error running schema update
net.sf.hibernate.HibernateException: hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:872)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:896)
at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.main(SchemaUpdate.java:65)

net.sf.hibernate.HibernateException: hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:872)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:896)
at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.main(SchemaUpdate.java:65)

Name and version of the database you are using: Cloudscape 10b

The generated SQL (show_sql=true): don't get this far!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 1:42 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:57 am
Posts: 33
Location: Alpharetta, Georgia
which tool are you using? what kind of classpath-ing is going on?


Top
 Profile  
 
 Post subject: SchemaUpdate
PostPosted: Mon Sep 13, 2004 2:15 pm 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
Am using SchemaUpdate, the entire command (I've added newlines to break up the classpath) is as follows:

d:\j2sdk1.4.2_05\bin\java -cp .;
d:\Cloudscape10b\lib\cs.jar;
d:\Cloudscape10b\lib\csnet.jar;
d:\Cloudscape10b\lib\cstools.jar;
d:\Cloudscape10b\lib\db2jcc.jar;
d:\Cloudscape10b\lib\db2jcc_license_c.jar;
d:\hibernate-2.1\src;
d:\hibernate-2.1\derby.jar;
d:\hibernate-2.1\hibernate2.jar;
d:\hibernate-2.1\tools\hibernate-tools.jar;
d:\hibernate-2.1\lib\cglib-2.0-rc2.jar;
d:\hibernate-2.1\lib\odmg-3.0.jar;
d:\hibernate-2.1\lib\xml-apis.jar;
d:\hibernate-2.1\lib\dom4j-1.4.jar;
d:\hibernate-2.1\lib\xerces-2.4.1.jar;
d:\hibernate-2.1\lib\xalan-2.4.1.jar;
d:\hibernate-2.1\tools\lib\jdom.jar;
d:\hibernate-2.1\lib\commons-logging-1.0.4.jar;
d:\hibernate-2.1\lib\commons-collections-2.1.1.jar;
d:\hibernate-2.1\lib\commons-lang-1.0.1.jar;
.\generated
net.sf.hibernate.tool.hbm2ddl.SchemaUpdate --format --output=.\schema.ddl --config=hibernate.cfg.xml Account.hbm-xml


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 2:50 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:57 am
Posts: 33
Location: Alpharetta, Georgia
Try adding the hibernate.cfg.xml to the classpath list as well.
This is part of the reason I always rely on ant, or even maven to help me with those things.


Top
 Profile  
 
 Post subject: classpath
PostPosted: Mon Sep 13, 2004 3:38 pm 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
Well, the hibernat.cfg.xml is in the current directory, which is the first entry in the classpath "." and I modified my script to also add the directory explicity to the classpath. None of this *seemed* to make a difference.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 4:23 pm 
Newbie

Joined: Tue Aug 24, 2004 5:33 am
Posts: 8
Location: Russia
Instead of "--config=hibernate.cfg.xml" try "--config=/hibernate.cfg.xml".
The method "getResourceAsStream" needs a slash "/".


Top
 Profile  
 
 Post subject: Documented feature?
PostPosted: Tue Sep 14, 2004 9:10 am 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
Well, that seemed to work, although it is not exactly obvious. Perhaps the documentation should describe this?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2004 11:48 am 
Newbie

Joined: Tue Aug 24, 2004 5:33 am
Posts: 8
Location: Russia
Of course, see java.lang.Class.getResourceAsStream


Top
 Profile  
 
 Post subject: Very good
PostPosted: Tue Sep 14, 2004 12:19 pm 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
But, I am a client of SchemaUpdate, why should I know or care that getResourceAsStream is used internally? and for all I know that might change over time anyway.


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