-->
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: ant + schemaexport = java.util.zip.ZipException
PostPosted: Mon Mar 01, 2004 6:19 pm 
Newbie

Joined: Tue Sep 30, 2003 12:59 pm
Posts: 8
trying to setup a basic ant script to generate the sql but i keep running into this issue, i'm i missing something?


<!-- generate sql files -->
<target name="generate-add-sql" depends="generate"
description="creates database tables">
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath>
<path refid="xdoclet.classpath"/>
<path refid="hibernate.classpath"/>
</classpath>
</taskdef>
<schemaexport quiet="no" text="no" drop="no" delimiter=";"
properties="${hibernate.properties}" output="${basedir}/ant/create-tables.sql">
<fileset dir="${webinf.dir}/classes" includes="**/model/*.hbm.xml"/>
</schemaexport>
</target>


<!-- Local system paths -->
<property file="${basedir}/ant/build.properties"/>
<property name="webroot.dir" value="${basedir}/jsp"/>
<property name="srcroot.dir" value="${basedir}/src"/>
<property name="webinf.dir" value="${webroot.dir}/WEB-INF"/>
<property name="xdoc.dir" value="C:/java/xdoclet-1.2/lib"/>
<property name="hib.dir" value="C:/java/hibernate-2.1/lib"/>
<property name="hibernate.jar" value="C:/java/hibernate-2.1/hibernate2.jar"/>
<property name="hibernate.properties" value="${srcroot.dir}/hibernate.properties"/>
<property name="build.dir" value="build"/>
<path id="compile.classpath">
<fileset dir="${webinf.dir}/lib" includes="*.jar"/>
</path>
<path id="hibernate.classpath">
<pathelement location="${hibernate.jar}"/>
<pathelement location="${hibernate.properties}"/>
<fileset dir="${hib.dir}" includes="*.jar"/>
</path>




Buildfile: C:\java\projects\opmetadata\ant\build.xml
clean:
[delete] Deleting directory C:\java\projects\opmetadata\jsp\WEB-INF\classes
[mkdir] Created dir: C:\java\projects\opmetadata\jsp\WEB-INF\classes
prepare:
resources:
[copy] Copying 3 files to C:\java\projects\opmetadata\jsp\WEB-INF\classes
compile:
[javac] Compiling 5 source files to C:\java\projects\opmetadata\jsp\WEB-INF\classes
generate:
[hibernatedoclet] (XDocletMain.start 47 ) Running <hibernate/>
[hibernatedoclet] Generating mapping file for com.openpeak.model.ManufacturerItem.
[hibernatedoclet] com.openpeak.model.ManufacturerItem
generate-add-sql:
[schemaexport] java.util.zip.ZipException: error in opening zip file
[schemaexport] at java.util.zip.ZipFile.open(Native Method)
[schemaexport] at java.util.zip.ZipFile.<init>(Unknown Source)
[schemaexport] at java.util.zip.ZipFile.<init>(Unknown Source)
[schemaexport] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:940)
[schemaexport] at org.apache.tools.ant.AntClassLoader.getResource(AntClassLoader.java:869)
[schemaexport] at org.apache.log4j.helpers.Loader.getResource(Loader.java:91)
[schemaexport] at org.apache.log4j.LogManager.<clinit>(LogManager.java:94)
[schemaexport] at org.apache.log4j.Category.getInstance(Category.java:530)
[schemaexport] at org.apache.commons.logging.impl.Log4jFactory.getInstance(Log4jFactory.java:140)
[schemaexport] at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:257)
[schemaexport] at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390)
[schemaexport] at net.sf.hibernate.cfg.Configuration.<clinit>(Configuration.java:91)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:182)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:401)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:338)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:413)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:176)
[schemaexport] (cfg.Environment 462 ) Hibernate 2.1.2
[schemaexport] (cfg.Environment 491 ) hibernate.properties not found
[schemaexport] (cfg.Environment 519 ) using CGLIB reflection optimizer
[schemaexport] (cfg.Configuration 166 ) Mapping file: C:\java\projects\opmetadata\jsp\WEB-INF\classes\com\openpeak\model\ManufacturerItem.hbm.xml
[schemaexport] (cfg.Configuration 252 ) Could not compile the mapping document
[schemaexport] net.sf.hibernate.MappingException: persistent class [com.openpeak.model.ManufacturerItem] not found
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229)
[schemaexport] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:171)
[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:306)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:401)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:338)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:413)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:176)
[schemaexport] Caused by: java.lang.ClassNotFoundException: com.openpeak.model.ManufacturerItem
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1187)
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1128)
[schemaexport] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:998)
[schemaexport] at java.lang.ClassLoader.loadClass(Unknown Source)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Unknown Source)
[schemaexport] at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:86)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81)
[schemaexport] ... 13 more
[schemaexport] (cfg.Configuration 175 ) Could not configure datastore from file: C:\java\projects\opmetadata\jsp\WEB-INF\classes\com\openpeak\model\ManufacturerItem.hbm.xml
[schemaexport] net.sf.hibernate.MappingException: persistent class [com.openpeak.model.ManufacturerItem] not found
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229)
[schemaexport] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:171)
[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:306)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:401)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:338)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:413)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:176)
[schemaexport] Caused by: java.lang.ClassNotFoundException: com.openpeak.model.ManufacturerItem
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1187)
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1128)
[schemaexport] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:998)
[schemaexport] at java.lang.ClassLoader.loadClass(Unknown Source)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Unknown Source)
[schemaexport] at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:86)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81)
[schemaexport] ... 13 more
BUILD FAILED: C:\java\projects\opmetadata\ant\build.xml:92: Schema text failed: net.sf.hibernate.MappingException: persistent class [com.openpeak.model.ManufacturerItem] not found
Total time: 4 seconds


Top
 Profile  
 
 Post subject: nevermind
PostPosted: Mon Mar 01, 2004 9:18 pm 
Newbie

Joined: Tue Sep 30, 2003 12:59 pm
Posts: 8
silly hibernate.properties in the classpath was screwing everything up.


Top
 Profile  
 
 Post subject: ant + schemaexport = java.util.zip.ZipException
PostPosted: Tue Apr 26, 2005 4:36 am 
Newbie

Joined: Tue Apr 26, 2005 4:22 am
Posts: 2
I also got this kind of error when I started with hibernate. Now, I got it working.

My experience is that the error message is quite confusing, but this only means that hibernate is not configured well, so it tries to get something from some strange places elsewhere

You just need to make sure that your hibernate are well configured. Check the following:
- log4j.properties is in classpath
- hibernate.properties in classpath (if you use it)
- your *.hbm.xml are in your classpath (Important note: if you use package, e.g., example.Team, hibernate will look for it in example/Team.hbm.xml. So, you need to put Team.hbm.xml in example directory)

You can got log4j.properties, hibernate.properties template from hibernate package.

- Peng


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.