2012-05-19 82 views
0

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

<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 

我不知道他们是否是相关的,但他们似乎已经推动我发疯,我只是想不通,为什么我会收到这些错误。

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

谢谢。

+1

您使用的是哪种JRE版本?我想我以前看过这个错误,我依稀记得它与JRE(来自Sun)中的一个错误有关。我可以混合东西了,虽然,我记得这个错误是模糊的,但我知道我已经处理过它... –

+0

@Jasper:我正在使用'jdk1.6.0_17'并且我配置了'-vm C :eclipse.ini中的\ Program Files(x86)\ Java \ jdk1.6.0_17 \ bin \ javaw.exe',并且已经在eclipse窗口的首选项中配置了指向我系统上'jdk1.6.0_17'文件夹的Installed JREs和Execution environment同样如此。 – skip

+1

哇,这相当一块古董;-)首先尝试更新到最新版本的6分支。 Java 6 Update 31. –

回答

0

删除存储库中的文件夹,maven会再次下载它。

C:\Users\lawson\.m2\repository\org\apache\xmlgraphics\batik-util\ 
相关问题