Hibernate version:3.2
It's a quite quite quite strange problem,and very very simple.I've downloaded the source code of the HelloWorld project from this website,and I'm trying out the examples.
Under directory helloworld-native,I got a build.xml file with its contents as follow:
---------------------------------------------------------------------------------------------------
<project name="Hello World" default="compile" basedir=".">
<!-- Name of project and version -->
<property name="proj.name" value="Hello World"/>
<property name="proj.shortname" value="helloworld"/>
<property name="version" value="1.0"/>
<!-- Global properties for this build -->
<property name="database.dir" value="database"/>
<property name="src.java.dir" value="src/java"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<!-- Classpath declaration -->
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<!-- Useful shortcuts -->
<patternset id="meta.files">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</patternset>
<!-- Clean up -->
<target name="clean" description="Clean the build directory">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<!-- Compile Java source -->
<target name="compile">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.java.dir}"
destdir="${build.dir}"
classpathref="project.classpath"/>
</target>
<!-- Copy metadata to build classpath -->
<target name="copymetafiles">
<mkdir dir="${build.dir}"/>
<copy todir="${build.dir}">
<fileset dir="${src.java.dir}">
<patternset refid="meta.files"/>
</fileset>
</copy>
</target>
<!-- Run HelloWorld -->
<target name="run" depends="compile, copymetafiles"
description="Build and run HelloWorld">
<java fork="true"
classname="hello.HelloWorld"
classpathref="project.classpath">
<classpath path="${build.dir}"/>
</java>
</target>
<!-- Hibernate Tools import --> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath"/>
<!-- Export the database schema --> <target name="schemaexport" depends="compile, copymetafiles" description="Exports a generated schema to DB and file">
<hibernatetool destdir="${basedir}"> <classpath path="${build.dir}"/> <configuration configurationfile="${build.dir}/hibernate.cfg.xml"/> <hbm2ddl drop="true" create="true" export="true" outputfilename="${proj.shortname}-ddl.sql" delimiter=";" format="true"/> </hibernatetool> </target>
<!-- Start the HSQL DB server -->
<target name="startdb" description="Run HSQL database server with clean DB">
<!-- Delete database files -->
<delete dir="${database.dir}"/>
<java classname="org.hsqldb.Server"
fork="yes"
classpathref="project.classpath"
failonerror="true">
<arg value="-database.0"/>
<arg value="file:${database.dir}/db"/>
</java>
</target>
<!-- Start the HSQL DB browser tool -->
<target name="dbmanager" description="Start HSQL DB manager">
<java
classname="org.hsqldb.util.DatabaseManagerSwing"
fork="yes"
classpathref="project.classpath"
failonerror="true">
<arg value="-url"/>
<arg value="jdbc:hsqldb:hsql://localhost/"/>
<arg value="-driver"/>
<arg value="org.hsqldb.jdbcDriver"/>
</java>
</target>
</project>
--------------------------------------------------------------------------------
when I test the example with the following command to run the task which was red above:
$ant schemaexport
I got the following error message:
---------------------------------------------------------------------------------------------------
Buildfile: build.xml
compile:
copymetafiles:
schemaexport:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
BUILD FAILED
/home/oracle/Codes/Java_Persistence_with_Hibernate/HelloWorld/helloworld-native/build.xml:71: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
-------------------------------------------------------------------------------------------------------
It's seems that it can't found the class LogFactory,but I DO have the lib files under my lib directory:
----------------------------------------------------------------------------------------------
antlr-2.7.6.jar
c3p0-0.9.0.jar
hibernate-tools.jar
antlr.license.txt
cglib-2.1.3.jar
hsqldb.jar
apache.license-2.0.txt
commons-collections-2.1.1.jar
jta.jar
apache.license.txt
commons-logging-1.0.4.jar
lgpl.txt
asm-attrs.jar
dom4j-1.6.1.jar
log4j-1.2.13.jar
asm.jar
hibernate3.jar
-------------------------------------------------------------------------------------------
WHAT'S THE MATTER?
I'AM really confused
|