-->
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.  [ 5 posts ] 
Author Message
 Post subject: hbm2dao giving mysterious NoClassDefFoundError
PostPosted: Thu Jul 13, 2006 10:07 am 
Newbie

Joined: Thu Jul 13, 2006 9:49 am
Posts: 8
I am trying to use the hibernatetool Ant task to perform DAO code generation using hbm2dao. I am using Hibernate 3.2.0.cr2 and Hibernate Tools 3.2.0 beta 6. Here is my Ant stuff:

Code:
<path id="toolslib">
   <path location="${dir.lib}/hibernate-tools.jar" />
   <path location="${dir.lib}/hibernate3.jar" />
   <path location="${dir.lib}/freemarker.jar" />
   <path location="${dir.lib}/hsqldb.jar}" />
   <path location="${dir.lib}/commons-logging.jar" />
   <path location="${dir.lib}/dom4j-1.6.1.jar" />
   <path location="${dir.lib}/cglib-2.1_3.jar" />
   <path location="${dir.lib}/commons-collections-2.1.1.jar" />
   <path location="${dir.lib}/log4j.jar" />
</path>

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />

<target name="hibernate-gen">
   <hibernatetool>
      <classpath refid="build.classpath" />
      <configuration>
         <fileset dir="${dir.src}">
            <include name="**/*.hbm.xml" />
         </fileset>
      </configuration>
      <hbm2dao destdir="${dir.gend}" />
   </hibernatetool>
</target>


It actually generates the correct code (it appears), but at the end of the process it throws a NoClassDefFoundError. Here is the log4j output:

Code:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2dao (Generates a set of DAOs)
[hibernatetool] 08:53:58,656 INFO  [Environment] Hibernate 3.2 cr2
[hibernatetool] 08:53:58,676 INFO  [Environment] hibernate.properties not found
[hibernatetool] 08:53:58,686 INFO  [Environment] Bytecode provider name : cglib
[hibernatetool] 08:53:58,696 INFO  [Environment] using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 08:53:59,006 INFO  [Configuration] Reading mappings from file: C:\dev\clientOpen\src\com\me\client\hibernate\Auditlog.hbm.xml
[hibernatetool] 08:53:59,457 INFO  [HbmBinder] Mapping class: com.me.client.hibernate.Auditlog -> AUDITLOG
[hibernatetool] 08:53:59,497 INFO  [Configuration] Reading mappings from file: C:\dev\clientOpen\src\com\me\client\hibernate\Audittypelookup.hbm.xml
[hibernatetool] 08:53:59,567 INFO  [HbmBinder] Mapping class: com.me.client.hibernate.Audittypelookup -> AUDITTYPELOOKUP
[hibernatetool] 08:53:59,577 INFO  [Configuration] Reading mappings from file: C:\dev\clientOpen\src\com\me\client\hibernate\Transactionlog.hbm.xml
[hibernatetool] 08:53:59,737 INFO  [HbmBinder] Mapping class: com.me.client.hibernate.Transactionlog -> TRANSACTIONLOG
[hibernatetool] 08:53:59,988 INFO  [Version] Hibernate Tools 3.1.0.beta5
[hibernatetool] 08:54:00,969 INFO  [TemplateProducer] Writing daohome.ftl to C:\dev\clientOpen\gend\com\me\client\hibernate\TransactionlogHome.java
[hibernatetool] 08:54:00,979 INFO  [TemplateProducer] Writing daohome.ftl to C:\dev\clientOpen\gend\com\me\client\hibernate\AudittypelookupHome.java
[hibernatetool] 08:54:00,989 INFO  [TemplateProducer] Writing daohome.ftl to C:\dev\clientOpen\gend\com\me\client\hibernate\AuditlogHome.java

BUILD FAILED
java.lang.NoClassDefFoundError: org/hibernate/engine/query/sql/NativeSQLQueryReturn


I can't find org.hibernate.engine.query.sql.NativeSQLQueryReturn anywhere - not in the 3.2cr2 codebase nor in the 3.1.3 codebase. Am I missing a file or is this a bug?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 10:15 am 
Newbie

Joined: Thu Jul 13, 2006 9:49 am
Posts: 8
P.S. I can generate DAO code using the Eclipse plugin without a problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 12:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
thats because eclipse uses the proper hibernate3.jar and you don't ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 2:37 pm 
Newbie

Joined: Thu Jul 13, 2006 9:49 am
Posts: 8
Ok, I pulled the hibernate3.jar file out of the Eclipse plugins directory, put it in my classpath, and it works now.

However, I am confused about why only the hibernate3.jar that comes with the Eclipse plugin has the classes necessary to run the Ant tasks. It seems to me that the Ant functionality should be available to all developers regardless of whether or not they use Eclipse.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 14, 2006 3:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you took the hibernate-tools.jar from the eclipse distribution too; that worked too right ? :)

we are planning on distributing a version of the tools with the core distribution, but at the moment we just do it through the eclipse build.
Previously we had 3 builds: core, tools and eclipse plugins and people were having even bigger problems (plus it was a nightmare to maintain :(

_________________
Max
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.  [ 5 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.