2012-05-19 81 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\ 
相關問題