我正在 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>