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.  [ 3 posts ] 
Author Message
 Post subject: UserType class not found during hbm2ddl
PostPosted: Thu Dec 20, 2007 8:01 am 
Newbie

Joined: Thu Dec 20, 2007 7:44 am
Posts: 5
I am trying to generate DDL from an XML hibernate mapping file, I do this using the hbm2ddl ant task. This worked well until I added my own custom UserType to the mapping. Now when I run hbm2ddl I get the following expection:

java.lang.NoClassDefFoundError: org/hibernate/usertype/UserType

I have hibernate3.jar on the classpath for the <taskdef> which defines hibernatetool and I have also tried putting the following inside the <hibernatetool> element:

<classpath>
<pathelement location="lib/hibernate3.jar"/>
<fileset dir="lib" includes="*.jar"/>
</classpath>

All to no avail. Why can't hibernatetool see the contents of my hibernate3.jar?

I am using hibernate-tools 3.2.0GA.

Here is a fragment of the stacktrace with ant on verbose mode:

--- Nested Exception ---
java.lang.NoClassDefFoundError: org/hibernate/usertype/UserType
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1414)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.java:223)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:260)
at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
at org.hibernate.mapping.Column.getSqlType(Column.java:182)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:394)
at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:848)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:94)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 2:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the error you are showing is because of you mixing hibernate jars - some on the task classpath and others on the <hibernatetool>

The only thing that should be on the hibernatetool classpath is your pojo/usertype classes, not any hibernate or other related jars.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 21, 2007 6:47 am 
Newbie

Joined: Thu Dec 20, 2007 7:44 am
Posts: 5
That was indeed the problem. OK, it's clear now, I put the hibernate jars on the taskdef classpath and my classes on the hibernatetool classpath and it all works fine. Thanks!


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