Hibernate version:
hibernate-3.2
Hi
Im trying to write an ant target which generates a ddl from annotated classes. The annotated classes are packaged in a jar-file entities.jar and works fine in my J2SE application.
Im running Ant in eclipse - here is a part of my build.xml that should do the magic:
---------------------------------------------------------
<path id="toolslib">
<path location="lib/hibernate-tools.jar" />
<path location="lib/hibernate3.jar" />
<path location="lib/freemarker.jar" />
<path location="lib/mysql-connector-java-3.0.14-production-bin.jar" />
<path location="lib/hibernate-annotations.jar" />
<path location="lib/ejb3-persistence.jar" />
<path location="lib/hibernate-entitymanager.jar" />
<path location="lib/jboss-archive-browsing.jar" />
<path location="lib/javaassist.jar" />
<path location="lib/commons-logging-1.0.4.jar" />
<path location="lib/dom4j-1.6.1.jar" />
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib" />
<target name="hibernate">
<hibernatetool destdir="${build.home}">
<jpaconfiguration persistenceunit="manager1"/>
<classpath>
<path location="${build.home}/WEB-INF/lib/entities.jar" />
</classpath>
<hbm2ddl export="false" outputfilename="sql.ddl"/>
</hibernatetool>
</target>
---------------------------------------------------------
When running the target hibernatetool -verbose the output is:
---------------------------------------------------------
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: C:\dev\weboverblik2\build.xml
parsing buildfile C:\dev\weboverblik2\build.xml with URI = file:///C:/dev/weboverblik2/build.xml
Project base dir set to: C:\dev\weboverblik2
[property] Loading C:\dev\weboverblik2\build.properties
dropping C:\dev\weboverblik2\lib\javaassist.jar from path as it doesn't exist
Build sequence for target(s) `hibernate' is [hibernate]
Complete build sequence is [hibernate, prepare, dev.compile, dev.entityjar, dev.war, deploy, reload, clean, dist.compile, install, database.drop, remove, javadoc, dist, compile.copyfiles, prepare.testdata, ]
hibernate:
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] 2006-11-09 10:15:51 org.hibernate.ejb.Version <clinit>
[hibernatetool] INFO: Hibernate EntityManager 3.2.0.GA
[hibernatetool] 2006-11-09 10:15:51 org.hibernate.cfg.annotations.Version <clinit>
[hibernatetool] INFO: Hibernate Annotations 3.2.0.GA
[hibernatetool] 2006-11-09 10:15:51 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2.0
[hibernatetool] 2006-11-09 10:15:51 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 2006-11-09 10:15:51 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] 2006-11-09 10:15:51 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
[hibernatetool] java.lang.reflect.InvocationTargetException
[hibernatetool] java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile
[hibernatetool] A class were not found in the classpath of the Ant task.
[hibernatetool] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.
BUILD FAILED
C:\dev\weboverblik2\build.xml:407: Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
at org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:42)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:287)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:28)
... 15 more
Caused by: java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile
at org.hibernate.ejb.packaging.JarVisitor.checkAnnotationMatching(JarVisitor.java:306)
at org.hibernate.ejb.packaging.JarVisitor.executeJavaElementFilter(JarVisitor.java:272)
at org.hibernate.ejb.packaging.JarVisitor.addElement(JarVisitor.java:233)
at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:48)
at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215)
at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:253)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:229)
... 20 more
--- Nested Exception ---
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:28)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:287)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile
at org.hibernate.ejb.packaging.JarVisitor.checkAnnotationMatching(JarVisitor.java:306)
at org.hibernate.ejb.packaging.JarVisitor.executeJavaElementFilter(JarVisitor.java:272)
at org.hibernate.ejb.packaging.JarVisitor.addElement(JarVisitor.java:233)
at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:48)
at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215)
at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:253)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:229)
... 20 more
Total time: 1 second
---------------------------------------------------------
hbm2ddl fails because it cannot fint the the class javassist/bytecode/ClassFile. BUT the class is in the jar javaassist.jar as defined in the path.
Is this a bug? Or, is something else missing?
Regards,
René
|