-->
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: Quite Strange Problem!!
PostPosted: Sat Dec 01, 2007 2:17 am 
Newbie

Joined: Sat Dec 01, 2007 1:38 am
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 03, 2007 3:19 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Add your jars in the classpath.

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.