-->
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.  [ 7 posts ] 
Author Message
 Post subject: Problems using hbm2ddl. Can't find a solution on the net
PostPosted: Wed Aug 03, 2005 10:00 am 
Newbie

Joined: Sun Jul 10, 2005 10:20 am
Posts: 17
Location: London
Hi, I'm trying to run hbm2ddl to have the sql scripts to generate my tables off the persistence classes generated automatically. I'm using an Ant task to generate the sql script. The hbm2ddl runs but I get two types of errors:

1) If I don't include the class files into the <fileset> for the hbm2ddl task, I get the following exception:

    Could not compile the mapping document
    net.sf.hibernate.MappingException: persistent class [org.jemos.hbm.vo.Category] not found
    at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
    at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
    at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
    at net.sf.hibernate.cfg.Configuration.add(Configuration.java:253)
    at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:175)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
    at com.werken.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:87)
    at com.werken.werkz.Goal.firePostGoalCallbacks(Goal.java:710)
    at com.werken.werkz.Goal.fire(Goal.java:654)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
    at com.werken.werkz.Goal.attain(Goal.java:573)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:368)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.cli.App.doMain(App.java:488)
    at org.apache.maven.cli.App.main(App.java:1239)
    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 com.werken.forehead.Forehead.run(Forehead.java:551)
    at com.werken.forehead.Forehead.main(Forehead.java:581)
    Caused by: java.lang.ClassNotFoundException: org.jemos.hbm.vo.Category
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1075)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1036)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:925)
    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:164)
    at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
    at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81)
    ... 60 more
    Could not configure datastore from file: D:\OPENSOURCES\eclipse_projects\hibernate-examples\hibernate-sar\target\cl
    asses\org\jemos\hbm\vo\Category.hbm.xml
    net.sf.hibernate.MappingException: persistent class [org.jemos.hbm.vo.Category] not found
    at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
    at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
    at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
    at net.sf.hibernate.cfg.Configuration.add(Configuration.java:253)
    at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:175)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
    at com.werken.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:87)
    at com.werken.werkz.Goal.firePostGoalCallbacks(Goal.java:710)
    at com.werken.werkz.Goal.fire(Goal.java:654)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
    at com.werken.werkz.Goal.attain(Goal.java:573)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:368)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.cli.App.doMain(App.java:488)
    at org.apache.maven.cli.App.main(App.java:1239)
    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 com.werken.forehead.Forehead.run(Forehead.java:551)
    at com.werken.forehead.Forehead.main(Forehead.java:581)
    Caused by: java.lang.ClassNotFoundException: org.jemos.hbm.vo.Category
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1075)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1036)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:925)
    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:164)
    at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
    at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81)
    ... 60 more



2) If I include the class files in the <fileset> with the following:

Code:
<fileset dir="${maven.build.dir}/classes/org/je 
      <include name="**/*.hbm.xml" />
      <include name="**/*.class" />
</fileset>      


Then I obtain the following exception:

    Error parsing XML: D:\OPENSOURCES\eclipse_projects\hibernate-examples\hibernate-sar\target\classes\org\jemos\hbm\vo
    \Category.class(1) Content is not allowed in prolog.
    Could not configure datastore from file: D:\OPENSOURCES\eclipse_projects\hibernate-examples\hibernate-sar\target\cl
    asses\org\jemos\hbm\vo\Category.class
    org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Con
    tent is not allowed in prolog.
    at org.dom4j.io.SAXReader.read(SAXReader.java:355)
    at org.dom4j.io.SAXReader.read(SAXReader.java:219)
    at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:173)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
    at com.werken.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:87)
    at com.werken.werkz.Goal.firePostGoalCallbacks(Goal.java:710)
    at com.werken.werkz.Goal.fire(Goal.java:654)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
    at com.werken.werkz.Goal.attain(Goal.java:573)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:368)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.cli.App.doMain(App.java:488)
    at org.apache.maven.cli.App.main(App.java:1239)
    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 com.werken.forehead.Forehead.run(Forehead.java:551)
    at com.werken.forehead.Forehead.main(Forehead.java:581)
    Nested exception:
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:339)
    at org.dom4j.io.SAXReader.read(SAXReader.java:219)
    at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:173)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
    at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
    at com.werken.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:87)
    at com.werken.werkz.Goal.firePostGoalCallbacks(Goal.java:710)
    at com.werken.werkz.Goal.fire(Goal.java:654)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
    at com.werken.werkz.Goal.attain(Goal.java:573)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:368)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
    at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
    at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
    at com.werken.werkz.Goal.fire(Goal.java:639)
    at com.werken.werkz.Goal.attain(Goal.java:575)
    at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
    at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
    at org.apache.maven.cli.App.doMain(App.java:488)
    at org.apache.maven.cli.App.main(App.java:1239)
    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 com.werken.forehead.Forehead.run(Forehead.java:551)
    at com.werken.forehead.Forehead.main(Forehead.java:581)

    BUILD FAILED
    File...... D:\MySite\maven\cache\maven-multiproject-plugin-1.3.1\plugin.jelly
    Element... maven:reactor
    Line...... 217
    Column.... 9
    Unable to obtain goal [multiproject:install-callback] -- D:\OPENSOURCES\eclipse_projects\hibernate-examples\hiberna
    te-sar\maven.xml:100:65: <schemaexport> Schema text failed: org.dom4j.DocumentException: Error on line 1 of documen
    t : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
    Total time: 7 seconds
    Finished at: Wed Aug 03 14:23:10 BST 2005


Hibernate version: 2.1


Name and version of the database you are using: MySQL 4.1.7-nt

I'm running on Windows XP SP2 with all the .jar files coming with Hibernate 2.1 in the classpath.

I looked everywhere on the net, but couldn't find a reason why I should get the above error.

This is the content of one of the files (for the Category class):

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping
>
    <class
        name="org.jemos.hbm.vo.Category"
        table="CATEGORIES"
    >

        <id
            name="id"
            type="long"
        >
                <column
                    name="ID"
                />
            <generator class="increment">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-Category.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <set
            name="childCategories"
            lazy="true"
            inverse="true"
            cascade="delete"
            sort="unsorted"
        >

            <key
                column="PARENT_ID"
            >
            </key>

            <many-to-many
                class="org.jemos.hbm.vo.Category"
                column="ID"
                outer-join="auto"
             />

        </set>

        <set
            name="items"
            lazy="true"
            inverse="true"
            cascade="none"
            sort="unsorted"
        >

            <key
                column="CATEGORY_ID"
            >
            </key>

            <many-to-many
                class="org.jemos.hbm.vo.Item"
                outer-join="auto"
             />

        </set>

        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
        >
            <column
                name="NAME"
                length="64"
            />
        </property>

        <many-to-one
            name="parentCategory"
            class="org.jemos.hbm.vo.Category"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="ID"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Category.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>



There is no funny character, nor spaces or blank lines before the beginning of the document.

I'd appreciate some help, also becuase I'm trying to 'introduce' Hibernate as persistence mechanism in the company where I work in replacement of entity beans. I already got the 'DB-to-Java' feature working, now I'd need to 'Java-to-DB' feature to work as well, otherwise I doubt that my colleagues would approve such change.

Thanks for any help,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 10:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the fileset is for mapping files - not class files.

class files goes into your classpath.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Thank you
PostPosted: Wed Aug 03, 2005 11:46 am 
Newbie

Joined: Sun Jul 10, 2005 10:20 am
Posts: 17
Location: London
Finally! You saved me :) I've been working three days on this and I couldn't find out why I was having that error. So it was related to the class file being included in the fileset. I now included the jar containing the class files into the classpath and it works fine.

I cannot tell you how grateful I am.

Thank you very much.


Top
 Profile  
 
 Post subject: Thanks for help
PostPosted: Sat Sep 17, 2005 10:39 am 
Newbie

Joined: Sat Sep 17, 2005 9:58 am
Posts: 1
I was playing with the same problem for a prety long..I am an ant newbie either..I did exacly what you said and it works finally!

Here is my build.xml

<project name="hibernate-tutorial" default="schemaexport">
<property name="proj.name" value="Message"/>
<property name="library.dir" value="D:/dev/lib" />
<property name="hibernate.cfg.file" value="${basedir}/hibernate.cfg.xml"/>
<property name="source.dir" value="${basedir}/src" />
<property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes"/>

<path id="libraries">
<fileset dir="${library.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${build.dir}">
<include name="**/*.jar"/>
</fileset>
</path>

<target name="clean">
<delete includeemptydirs="true">
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}"/>
</target>

<target name="compile" depends="clean, copy-resources">
<javac srcdir="${source.dir}" destdir="${classes.dir}" classpathref="libraries" />
</target>

<target name="copy-resources">
<copy todir="${build.dir}">
<fileset dir="${basedir}">
<include name="*.xml"/>
<include name="*.dtd"/>
<exclude name="build.xml"/>
</fileset>
</copy>
</target>

<target name="classes.package" depends="compile">
<zip destfile="${build.dir}/${proj.name}.jar">
<fileset dir="${classes.dir}">
<include name="**/*.class"/>
</fileset>
</zip>
</target>

<target name="schemaexport" depends="classes.package">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="libraries" />
<schemaexport
config="${hibernate.cfg.file}"
quiet="no" text="yes" drop="no"
delimiter=";"
output="${proj.name}.sql"
>
</schemaexport>
</target>
</project>

Notice classes.package target !


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 10:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it is not required that you zip your files into a .jar/.zip - just add the classes directory to the classpath.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: deleted
PostPosted: Tue Jan 03, 2006 8:56 am 
Newbie

Joined: Thu Nov 24, 2005 2:19 am
Posts: 10
deleted


Last edited by ramin_farhanian on Fri Jun 06, 2014 11:28 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 10:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
We don't have any knowledge about any hibernate plugin to Maven.

/max

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