【问题标题】:hibernatetool: java.util.zip.ZipException: error in opening zip filehibernatetool:java.util.zip.ZipException:打开 zip 文件时出错
【发布时间】:2012-05-19 20:17:09
【问题描述】:

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

<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)

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

另外,当我尝试在我的项目 pom.xml 上调整 mvn install 时,有时我也会得到以下信息。我正在使用 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

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

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

谢谢。

【问题讨论】:

  • 您使用的是什么 JRE 版本?我想我以前见过这个错误,我隐约记得它与 JRE(来自 Sun)中的一个错误有关。不过,我可能会把事情搞混,我对这个错误的回忆很模糊,但我知道我之前已经处理过它......
  • @Jasper:我正在使用jdk1.6.0_17,并且我在 eclipse.ini 中配置了-vm C:\Program Files (x86)\Java\jdk1.6.0_17\bin\javaw.exe,并在指向我系统上jdk1.6.0_17 文件夹的 Eclipse Windows 首选项中配置了已安装的 JRE 和执行环境也一样。
  • 哇,这真是一件古董;-) 首先尝试更新到最新版本的 6 分支。 Java 6 更新 31。
  • @Jasper:我是对的,很快就会更新你。谢谢。
  • 从本地 Maven 存储库(缓存)中删除 Batik 目录 'C:\Users\lawson\.m2\repository\org\apache\xmlgraphics\batik-util\1.7\',以便 Maven 下载再说一遍。它可能已损坏。顺便说一句,如果您需要添加一些内容,您也可以编辑您的评论。

标签: eclipse spring hibernate maven ant


【解决方案1】:

删除repo中的文件夹,maven会重新下载。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多