-->
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: problem with hibernate tool
PostPosted: Thu Oct 08, 2009 6:59 pm 
Regular
Regular

Joined: Wed Jan 28, 2009 8:31 pm
Posts: 54
Hello I try the tutorial of hibernate tool

this is my ant code
Code:
<path id="toolslib">
         <path location="lib/hibernate-tools.jar" />
         <path location="lib/hibernate3.jar" />
         <path location="lib/freemarker.jar" />
         <path location="${jdbc.driver.jar}" />
      </path>
      <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />

      <target name="hibernatetool">
         <hibernatetool destdir="${build.dir}/generated">
            <classpath>
               <path location="${build.dir}/classesTest" />
            </classpath>
         <configuration configurationfile="hibernate.cfg.xml" />
         <hbm2java />
         </hibernatetool>
      </target>


my classpath
Code:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
   <classpathentry kind="src" path="src"/>
   <classpathentry kind="src" path="test"/>
   <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
   <classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
   <classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
   <classpathentry kind="lib" path="lib/javassist-3.4.GA.jar"/>
   <classpathentry kind="lib" path="lib/jta-1.1.jar"/>
   <classpathentry kind="lib" path="lib/hibernate3.jar"/>
   <classpathentry kind="lib" path="lib/slf4j-api-1.5.6.jar"/>
   <classpathentry kind="lib" path="lib/CallServicesJW.jar"/>
   <classpathentry kind="lib" path="lib/ctgclient.jar"/>
   <classpathentry kind="lib" path="lib/fda7.jar"/>
   <classpathentry kind="lib" path="lib/ojdbc14.jar"/>
   <classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
   <classpathentry kind="lib" path="lib/commons-beanutils-1.8.0.jar"/>
   <classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
   <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
   <classpathentry kind="lib" path="lib/slf4j-log4j12-1.5.6.jar"/>
   <classpathentry kind="lib" path="lib/iText-2.1.5.jar"/>
   <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
   <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
   <classpathentry kind="lib" path="lib/dozer-5.1.jar"/>
   <classpathentry kind="lib" path="lib/hibernate-tools.jar"/>
   <classpathentry kind="lib" path="lib/dbunit-2.4.6.jar"/>
   <classpathentry kind="lib" path="lib/freemarker.jar"/>
   <classpathentry kind="output" path="build"/>
</classpath>


and my console with this error
Quote:
BUILD FAILED
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.hibernate.tool.hbm2x.AbstractExporter.<init>(AbstractExporter.jav
a:25)
at org.hibernate.tool.hbm2x.GenericExporter.<init>(GenericExporter.java:
77)
at org.hibernate.tool.hbm2x.POJOExporter.<init>(POJOExporter.java:28)
at org.hibernate.tool.ant.Hbm2JavaExporterTask.createExporter(Hbm2JavaEx
porterTask.java:41)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:186)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)


I don t anderstand
I have hibernate-tools.jar in my classpath
can someone help me please


Top
 Profile  
 
 Post subject: Re: problem with hibernate tool
PostPosted: Fri Oct 09, 2009 6:16 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
You are missing the org.apache.commons.logging.LogFactory class.

It should be in commons-logging-1.1.1.jar, which is on the class path. Maybe somebody renamed a different file into that name.
Another, more likely possibility is that your code is using a different classpath than the one you posted.
The third possibility is that the .jar is not where the classpath assumes it is.

[UPDATE] Hibernate Tools generate artifacts such as classes and configuration files that get rolled into your application, they aren't needed once they did their job in Eclipse and don't need to be included in the program's class path.


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.