Hi,
I've been trying to use SchemaExport in Ant.
When I try to generate the DDL command line it works fine, but in Ant there seems to be a problem I think with locating the class files. The strange thing is that my path includes the classes folder.
Solution:
While typing this email I found out that the problem was with Ant / Eclipse, I added the required libraries (Hibernate2.jar, Dom4j, Common loggings) to Ant Home Entries in Eclipse. And I also copied the Jar to the lib folder of Ant. This caused this strange error.
Full stack trace of any exception that occurs:
Buildfile: D:\workspace\AskNow\build.xml
[echo] Started build 15:34:59
[echo] hbm2ddl.classpath is D:\workspace\AskNow\lib\activation.jar;D:\workspace\AskNow\lib\ask_now_client.jar;D:\workspace\AskNow\lib\ask_now_client_carp.jar;D:\workspace\AskNow\lib\cfusion.jar;D:\workspace\AskNow\lib\cglib-full-2.0.2.jar;D:\workspace\AskNow\lib\commons-collections-2.1.1.jar;D:\workspace\AskNow\lib\commons-dbcp-1.2.1.jar;D:\workspace\AskNow\lib\commons-logging-1.0.4.jar;D:\workspace\AskNow\lib\commons-pool-1.2.jar;D:\workspace\AskNow\lib\dom4j-1.3.jar;D:\workspace\AskNow\lib\ehcache-0.9.jar;D:\workspace\AskNow\lib\firebirdsql-full.jar;D:\workspace\AskNow\lib\gnujaxp.jar;D:\workspace\AskNow\lib\hibernate2.jar;D:\workspace\AskNow\lib\htmlparser.jar;D:\workspace\AskNow\lib\jta.jar;D:\workspace\AskNow\lib\log4j-1.2.8.jar;D:\workspace\AskNow\lib\lucene-1.3-final.jar;D:\workspace\AskNow\lib\mail.jar;D:\workspace\AskNow\lib\odmg-3.0.jar;D:\workspace\AskNow\lib\spring.jar;D:\workspace\AskNow\lib\tm-extractors-0.2.jar;D:\workspace\AskNow\lib\velocity-dep-1.4.jar;D:\workspace\AskNow\lib\weka.jar;D:\workspace\AskNow\src\conf;D:\workspace\AskNow\src\conf\merge;D:\workspace\AskNow\src\conf\merge\springdoclet
schemaexport-sqlserver:
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: Hibernate 2.1.7
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: hibernate.properties not found
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using CGLIB reflection optimizer
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Configuration addFile
[schemaexport] INFO: Mapping file: D:\workspace\AskNow\gen\nl\asknow\resource\model\Resource.hbm.xml
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Configuration add
[schemaexport] SEVERE: Could not compile the mapping document
[schemaexport] net.sf.hibernate.MappingException: persistent class [nl.asknow.resource.model.Resource] not found
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:85)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:222)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1257)
[schemaexport] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: java.lang.ClassNotFoundException: nl.asknow.resource.model.Resource
[schemaexport] at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
[schemaexport] at java.security.AccessController.doPrivileged(Native Method)
[schemaexport] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[schemaexport] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Class.java:141)
[schemaexport] at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:82)
[schemaexport] ... 14 more
[schemaexport] 18-jan-2005 14:35:01 net.sf.hibernate.cfg.Configuration addFile
[schemaexport] SEVERE: Could not configure datastore from file: D:\workspace\AskNow\gen\nl\asknow\resource\model\Resource.hbm.xml
[schemaexport] net.sf.hibernate.MappingException: persistent class [nl.asknow.resource.model.Resource] not found
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:85)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:222)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1257)
[schemaexport] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: java.lang.ClassNotFoundException: nl.asknow.resource.model.Resource
[schemaexport] at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
[schemaexport] at java.security.AccessController.doPrivileged(Native Method)
[schemaexport] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[schemaexport] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Class.java:141)
[schemaexport] at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:82)
[schemaexport] ... 14 more
BUILD FAILED: D:\workspace\AskNow\build.xml:168: Schema text failed: net.sf.hibernate.MappingException: persistent class [nl.asknow.resource.model.Resource] not found
Total time: 2 seconds
|