Hello, hoping someone can help me with this problem that is bound to be a result of some stupid oversight of mine.
The problem is that SchemaExport can't find hibernate.cfg.xml , despite the fact that it's in the classpath. Configuration(), called from my own code with the same classpath,
can find it (and the .hbm.xml files, which live in the same place). I have tried it both from ant:
Code:
<project name="lockup" basedir="../" default="all">
[...]
<path id="compile.classpath">
[...]
<pathelement path="classes"/>
[...]
<target name="schemaexport" depends="project">
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="compile.classpath"/>
<schemaexport quiet="no" text="no" drop="no" delimiter=";" config="hibernate.cfg.xml" properties="" output="schema-export.sql">
<fileset dir="src/java">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
and on the command line:
Code:
java -cp ../classes:../lib/hibernate-tools.jar:../lib/hibernate2.jar:../lib/commons-collections.jar:../lib/commons-logging.jar:../lib/jdom.jar:../lib/commons-lang.jar:../lib/dom4j-1.4.jar:../lib/odmg-3.0.jar net.sf.hibernate.tool.hbm2ddl.SchemaExport --config="hibernate.cfg.xml"
Either way, I get
Code:
[...]
INFO: configuring from resource: hibernate.cfg.xml
Jul 8, 2004 3:39:18 PM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: hibernate.cfg.xml
Jul 8, 2004 3:39:18 PM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
WARNING: hibernate.cfg.xml not found
Jul 8, 2004 3:39:18 PM net.sf.hibernate.tool.hbm2ddl.SchemaExport main
SEVERE: Error creating schema
net.sf.hibernate.HibernateException: hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:849)
[...]
, despite the fact that hibernate.cfg.xml exists in ../classes.
This is with Hibernate 2.1. Thanks in advance for any help you can give.