title: hibernatetool: java.util.zip.ZipException: error in opening zip file
body: <p>I am trying to run <code>build-sql</code> ant task which is giving me the following <code>[hibernatetool] java.util.zip.ZipException: error in opening zip file</code>. As it shows that this task does quite a lot which it actually does but it doesn't populate the database tables which it is supposed to. I think it is because of this error that I am getting. And as I read it somewhere that it might be because of having a <code>.properties</code> file inside <code>WEB-INF</code>, I do not have any <code>.properties</code> file inside <code>WEB-INF</code> of the project.</p>
  
  <pre><code>&lt;target name="build-sql"&gt;
      &lt;mkdir dir="target/sql"/&gt;
      &lt;artifact:pom id="myPom" file="pom.xml" /&gt;
      &lt;artifact:dependencies filesetId="pomDeps" pomRefId="myPom" useScope="compile" /&gt;
      &lt;property name="baseTarget" location="target/${myPom.build.finalName}/WEB-INF"/&gt;
      &lt;fileset id="libDir" dir="${baseTarget}/lib"/&gt;
      &lt;path id="build.runtime.classpath"&gt;
          &lt;restrict&gt;
              &lt;difference&gt;
                  &lt;fileset refid="pomDeps" /&gt;
                  &lt;intersect&gt;
                      &lt;fileset refid="pomDeps" /&gt;
                      &lt;fileset refid="libDir" /&gt;
                  &lt;/intersect&gt;
              &lt;/difference&gt;
              &lt;rsel:not&gt;
                  &lt;rsel:name name="**/*.pom" /&gt;
              &lt;/rsel:not&gt;
          &lt;/restrict&gt;
          &lt;fileset refid="libDir"/&gt;
      &lt;/path&gt;
      &lt;taskdef name="hibernatetool" classname="org.tbs.common.util.sql.HibernateToolTask" classpathref="build.runtime.classpath" /&gt;
      &lt;hibernatetool destDir="target/sql" combinePersistenceUnits="false" refineFileNames="true"&gt;
          &lt;classPathApplicationContext path="tbs-open-admin-contentClient-applicationContext.xml"/&gt;
          &lt;classPathApplicationContext path="tbs-cms-contentClient-applicationContext.xml"/&gt;
          &lt;classPathApplicationContext path="headmaster-applicationContext.xml"/&gt;
          &lt;jpaconfiguration persistenceUnit="tbsPU" dialect="org.hibernate.dialect.MySQLDialect" /&gt;
          &lt;jpaconfiguration persistenceUnit="tbsSecurePU" dialect="org.hibernate.dialect.MySQLDialect" /&gt;
          &lt;jpaconfiguration persistenceUnit="tbsCMSStorage" dialect="org.hibernate.dialect.MySQLDialect" /&gt;
          &lt;classpath refid="build.runtime.classpath" /&gt;
          &lt;hbm2ddl export="false"/&gt;
      &lt;/hibernatetool&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>Following is the error part of logging:</p>
  
  <pre><code>[hibernatetool] java.util.zip.ZipException: error in opening zip file
  [hibernatetool]     at java.util.zip.ZipFile.open(Native Method)
  [hibernatetool]     at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:114)
  [hibernatetool]     at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:131)
  [hibernatetool]     at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)
  [hibernatetool]     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)
  [hibernatetool]     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.&lt;init&gt;(AntClassLoader.java:109)
  [hibernatetool]     at org.apache.tools.ant.AntClassLoader.findResources(AntClassLoader.java:975)
  [hibernatetool]     at java.lang.ClassLoader.getResources(ClassLoader.java:996)
  [hibernatetool]     at org.slf4j.LoggerFactory.singleImplementationSanityCheck(LoggerFactory.java:212)
  [hibernatetool]     at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:110)
  [hibernatetool]     at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
  [hibernatetool]     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
  [hibernatetool]     at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
  [hibernatetool]     at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
  [hibernatetool]     at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
  [hibernatetool]     at org.tbs.common.extensibility.context.StandardConfigLocations.&lt;clinit&gt;(StandardConfigLocations.java:29)
  [hibernatetool]     at org.tbs.common.util.sql.HibernateToolTask.execute(HibernateToolTask.java:131)
  [hibernatetool]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
  [hibernatetool]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [hibernatetool]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  [hibernatetool]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  [hibernatetool]     at java.lang.reflect.Method.invoke(Method.java:597)
  [hibernatetool]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  [hibernatetool]     at org.apache.tools.ant.Task.perform(Task.java:348)
  [hibernatetool]     at org.apache.tools.ant.Target.execute(Target.java:357)
  [hibernatetool]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
  [hibernatetool]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
  [hibernatetool]     at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
  [hibernatetool]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
  [hibernatetool]     at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
  [hibernatetool]     at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
  [hibernatetool]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
  [hibernatetool]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
  </code></pre>
  
  <p>I am just not able to understand the reason behind this.</p>
  
  <p>Also, sometimes I get the following as well when I try to tun <code>mvn install</code> on my projects <code>pom.xml</code>. I am using Eclipse Java EE IDE Helios.</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project natura: Compilation failure
  [ERROR] error: error reading C:\Users\lawson\.m2\repository\org\apache\xmlgraphics\batik-util\1.7\batik-util-1.7.jar; cannot read zip file entry
  </code></pre>
  
  <p>I am not sure if they are related but they seem to have driven me nuts already as I just can't figure out why am I getting those errors.</p>
  
  <p>Could someone please help understand what am I missing here to resolve these problems.</p>
  
  <p>Thanks.</p>