Hi all,
I spent many hours in the last week to a problem with a hibernate 3 SchemaExportTask called by ant, but I don't find a solution. I hope that anybody can help me.
Always if I run the task I will become the same error message:
Schema text failed: resource: com/project/service/hibernate/Country.hbm.xml not found
Code:
Buildfile: I:\project\dev\workspace\projectBackend\build.xml
_create db-schema:
[echo] The database schema will be created related by the hibernate mapping...
[schemaexport] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[schemaexport] log4j:WARN Please initialize the log4j system properly.
BUILD FAILED
I:\project\dev\workspace\projectBackend\build.xml:135: Schema text failed: resource: com/project/service/hibernate/Country.hbm.xml not found
Total time: 953 milliseconds
So my opinion is that there is an erroneous classpath, but it looks clean (build.xml):
Code:
...
<property name="classes.dir" value="classes"/>
<property name="lib.dir" value="lib"/>
...
<path id="lib.class.path">
<pathelement location="${classes.dir}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
...
<target name="_create db-schema" description="Creates the database schema by using the mapping documents">
<echo message="The database schema will be created related by the hibernate mapping..." level="info"/>
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="lib.class.path" />
<!-- the following element throws the error -->
<schemaexport config="${classes.dir}/hibernate.cfg.xml"
quiet="no"
text="yes"
drop="no"
delimiter=";"
output="${sql.dir}/${schema.name}.sql" />
<echo message="Done." level="info"/>
</target>
...
The lib dir contains:
Code:
antlr-2.7.6.jar
asm-attrs.jar
asm.jar
backport-util-concurrent.jar
cfgatewayadapter.jar
cglib-2.1.3.jar
commons-codec-1.3.jar
commons-collections-3.1.jar
commons-httpclient-3.0.1.jar
commons-logging.jar
concurrent.jar
dom4j-1.6.1.jar
flex-messaging-common.jar
flex-messaging-core.jar
flex-messaging-opt.jar
flex-messaging-proxy.jar
flex-messaging-remoting.jar
freemarker.jar
hibernate-cglib-repack-2.1_3.jar
hibernate-tools.jar
hibernate3.jar
hsqldb.jar
javassist-3.4.GA.jar
jta-1.1.jar
log4j-1.2.15.jar
mysql-connector-java-5.1.7-bin.jar
slf4j-api-1.5.5.jar
slf4j-log4j12-1.5.5.jar
spring.jar
xalan.jar
The classes folder contains:
Code:
...
com/project/service/hibernate/Country.hbm.xml
com/project/service/hibernate/Language.hbm.xml
com/project/service/hibernate/Location.hbm.xml
com/project/service/hibernate/User.hbm.xml
...
hibernate.cfg.xml
log4j.properties
...
Because the classpath looks ok, I checked the mapping inside of hibernate.cfg.xml:
Code:
...
<hibernate-configuration>
<session-factory>
...
<mapping resource="com/project/service/hibernate/Country.hbm.xml" />
<mapping resource="com/project/service/hibernate/Language.hbm.xml" />
<mapping resource="com/project/service/hibernate/User.hbm.xml" />
<mapping resource="com/project/service/hibernate/Location.hbm.xml" />
</session-factory>
</hibernate-configuration>
The needed libs are referenced from my ANT HOME and other tasks like the generation of the POJOs with org.hibernate.tool.ant.HibernateToolTask works fine.
I tried alternative paths and I searched in forums and tutorials. I found some threads that handles similar problems, but I don't found a way to solve my issue.
- I am sure that the classpath is correct, so which other reasons could be there?
- Do anybody see a misstake in my config?
- Is there a version conflict of my libs?
I don't have more ideas what to do, please help me...
Thx a lot,
frustrated Nepumuk