java.util.zip.ZipException:在tomcat中部署war时无效的LOC头(错误的签名)

时间:2013-08-02 19:43:14

标签: tomcat ant war

我正在tomcat的webapps文件夹中部署war文件,我收到了以下错误。可能是什么原因。我经历了几个论坛帖子,但我没有得到任何富有成效的结果。

java.util.zip.ZipException:无效的LOC标头(错误的签名)

以下是build.xml

<!-- setting classpath -->
<path id="tomcat.class.path">
    <pathelement location="C:/Users/test/Downloads/apache-tomcat-7.0.42-windows-x64/apache-tomcat-7.0.42/lib/servlet-api.jar" />
    <pathelement location="C:/Users/test/Downloads/apache-tomcat-7.0.42-windows-x64/apache-tomcat-7.0.42/lib/jsp-api.jar" />
</path>

    <path id="base.class.path">
    <pathelement location="classes" />
    <pathelement location="lib" />
    <!--new files for paypal -->
    <pathelement location="lib/bcpg-jdk14-138.jar" />
    <pathelement location="lib/bcprov-jdk14-138.jar" />
    <pathelement location="lib/commons-codec-1.3.jar" />
    ....

....     

  
   <property file="build.properties"/>

    <path id="classpath">
        <fileset dir="${lib.dir}"/>
    </path>

    <target name="clean">
        <echo>Cleaning the ${htdocs.webinf.dir} and ${dist.dir} directories</echo>
        <delete dir="${htdocs.dir/WEB-INF}"/>
        <delete dir="${dist.dir}"/> 
    </target>

    <target name="init" depends="clean">
        <echo>Creating the htdocs directory</echo>
        <mkdir dir="${htdocs.dir}/WEB-INF/classes"/>
        <mkdir dir="${htdocs.dir}/WEB-INF/lib"/>
        <mkdir dir="${dist.dir}"/>      
    </target>

    <target name="compile" depends="init">
        <echo>Compile the source files</echo>
        <javac srcdir="${classes.dir}" destdir="${htdocs.dir}/WEB-INF/classes">
            <classpath refid="base.class.path"/>    
            <classpath refid="tomcat.class.path"/>              
        </javac>
    </target>

    <target name="copy" depends="compile">
        <copy todir="${htdocs.dir}/WEB-INF">
            <fileset dir="${tomcat.webinf}/WEB-INF"/>
        </copy>

        <copy todir="${htdocs.dir}/WEB-INF/lib">
            <fileset dir="${lib.dir}">
            </fileset>
        </copy>
    </target>


    <target name="war">
        <echo>Building the war file</echo>
        <war destfile="${dist.dir}/${ant.project.name}.war" webxml="${htdocs.dir}/WEB-INF/web.xml">
            <fileset dir="${htdocs.dir}"/>
        </war>
    </target>

        <target name="deploy_local" depends="war">
        <echo>Deploying .war to local Tomcat</echo>
        <copy todir="${tomcat.dir}/webapps">
            <fileset dir="${dist.dir}">
                <include name="${ant.project.name}.war"/>
            </fileset>
        </copy>
    </target>

1 个答案:

答案 0 :(得分:1)

Java 7之前不支持大型zip文件:

http://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile

通过名为ZIP64的扩展程序。这就是你无法部署战争的原因。