-->
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.  [ 2 posts ] 
Author Message
 Post subject: Classpath problems...
PostPosted: Mon Feb 07, 2005 1:43 pm 
Newbie

Joined: Thu Feb 03, 2005 11:36 am
Posts: 11
Hi, I'm trying to use SchemaExport and SchemaUpdate from an Ant script within Eclipse.

I have two problems related with classpath settings :
1) SchemaExport and SchemaUpdate both fail
2) I can't log anything

log4j.properties is in classes directory
the .java files are generated by hbm2java into src/hibgen directory
the lib directory contains all the *.jar files needed by hibernate (I'm currently using hibernate from a servlet without many problems except my lack of knowledge ;-)

So, no logging is enabled (log4j:WARN Please initialize the log4j system properly)

AND my main concern :
net.sf.hibernate.MappingException: persistent class [hibgen.Message] not found

I even use a Windows File Monitoring utility and can see that hibgen/Message.class is read successfully several times during and the build process.

I've tried the FAQ, the doc and to gather informations from this forum.
I really don't know what to do...
Could someone help me ?

Thanks

Hibernate version:
2.1
Mapping documents:
<hibernate-mapping package="hibgen">

<class name="Message" table="message">
<id name="id" type="long" column="id"><generator class="vm"/></id>
<property name="title" column="title" type="string" not-null="false" length="255" />
<property name="content" column="content" type="text" not-null="false"/>
<property name="datecreated" column="datecreated" type="date" not-null="false"/>
</class>

</hibernate-mapping>

Ant script

<project name="mytest" default="hib_exportddl" basedir=".">

<property name="src.dir" location="WEB-INF/src"/>
<property name="lib.dir" location="WEB-INF/lib"/>
<property name="bin.dir" location="WEB-INF/classes"/>

<path id="classpath">
<pathelement location="${src.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${bin.dir}">
<include name="**/*.class" />
<include name="**/log4j.properties" />
</fileset>
<fileset dir="${bin.dir}/hibgen">
<include name="**/*.class" />
</fileset>
</path>

<taskdef name="schemaupdate" classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask" classpathref="classpath"/>
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="classpath"/>

<target name="hib_exportddl">
<schemaupdate properties="WEB-INF/hibernate.properties" quiet="no">
<fileset dir="${bin.dir}">
<include name="**/*.hbm.xml" />
</fileset>
</schemaupdate>
</target>

</project>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 2:19 pm 
Newbie

Joined: Thu Feb 03, 2005 11:36 am
Posts: 11
I've found a (weird ?) solution...

Under eclipse Ant run configuration, added classes directory to Ant classpath directory... Et voila !


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