hibernatetool:java.util.zip.ZipException:打开zip文件时出错

时间:2012-05-19 20:17:09

标签: eclipse spring hibernate maven ant

我正在尝试运行build-sql ant任务,它给了我以下[hibernatetool] java.util.zip.ZipException: error in opening zip file。因为它表明这个任务实际上做了很多,但它没有填充它应该填充的数据库表。我认为这是因为我得到的这个错误。当我在某处读到它可能是因为在.properties中有一个WEB-INF文件,我在项目的.properties内没有任何WEB-INF文件。

<target name="build-sql">
    <mkdir dir="target/sql"/>
    <artifact:pom id="myPom" file="pom.xml" />
    <artifact:dependencies filesetId="pomDeps" pomRefId="myPom" useScope="compile" />
    <property name="baseTarget" location="target/${myPom.build.finalName}/WEB-INF"/>
    <fileset id="libDir" dir="${baseTarget}/lib"/>
    <path id="build.runtime.classpath">
        <restrict>
            <difference>
                <fileset refid="pomDeps" />
                <intersect>
                    <fileset refid="pomDeps" />
                    <fileset refid="libDir" />
                </intersect>
            </difference>
            <rsel:not>
                <rsel:name name="**/*.pom" />
            </rsel:not>
        </restrict>
        <fileset refid="libDir"/>
    </path>
    <taskdef name="hibernatetool" classname="org.tbs.common.util.sql.HibernateToolTask" classpathref="build.runtime.classpath" />
    <hibernatetool destDir="target/sql" combinePersistenceUnits="false" refineFileNames="true">
        <classPathApplicationContext path="tbs-open-admin-contentClient-applicationContext.xml"/>
        <classPathApplicationContext path="tbs-cms-contentClient-applicationContext.xml"/>
        <classPathApplicationContext path="headmaster-applicationContext.xml"/>
        <jpaconfiguration persistenceUnit="tbsPU" dialect="org.hibernate.dialect.MySQLDialect" />
        <jpaconfiguration persistenceUnit="tbsSecurePU" dialect="org.hibernate.dialect.MySQLDialect" />
        <jpaconfiguration persistenceUnit="tbsCMSStorage" dialect="org.hibernate.dialect.MySQLDialect" />
        <classpath refid="build.runtime.classpath" />
        <hbm2ddl export="false"/>
    </hibernatetool>
</target>

以下是日志记录的错误部分:

[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.<init>(ZipFile.java:114)
[hibernatetool]     at java.util.zip.ZipFile.<init>(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.<init>(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.<clinit>(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)

我只是无法理解背后的原因。

另外,当我尝试在项目mvn install上调用pom.xml时,有时我也会得到以下内容。我正在使用Eclipse Java EE IDE Helios。

[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

我不确定他们是否相关,但他们似乎已经让我疯了,因为我无法弄清楚为什么我会收到这些错误。

有人可以帮助了解我在这里错过了什么来解决这些问题。

感谢。

1 个答案:

答案 0 :(得分:0)

删除repo中的文件夹,maven将再次下载。

C:\Users\lawson\.m2\repository\org\apache\xmlgraphics\batik-util\