java.util.zip.ZipException: invalid LOC header (bad signature搞得我头痛啊,求大仙救我
九月 05, 2013 7:13:06 下午 org.apache.catalina.startup.TldConfig tldScanJar
SEVERE: Exception processing TLD META-INF/tlds/struts-tiles.tld in JAR at resource path E:\workspaces\workspace01\firstproject\target\firstproject-0.0.1-SNAPSHOT\WEB-INF\lib\struts-1.2.9.jar in context /firstproject
java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:56)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:677)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:413)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2872)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:659)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:799)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
at org.apache.catalina.startup.TldConfig.tldScanStream(TldConfig.java:401)
at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:363)
at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:275)
at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:636)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4612)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
exception --------------------编程问答-------------------- JAR起了冲突了把,应该是 --------------------编程问答--------------------
/**--------------------编程问答-------------------- 什么意思?你这是修改源码还是?
* 压缩文件
* @param filePaths 存放文件物理路径的集合
* @param fileNames 文件的名称(和文件路径对应,可以是中文)
* @param outPath 压缩文件的输出路径(物理路径)
*/
public void reduceFile(List<String> filePaths, List<String> fileNames, String outPath) {
if (null != filePaths && filePaths.size() > 0 && null != fileNames && fileNames.size()== filePaths.size()) {
try {
OutputStream fileOutput = new FileOutputStream(outPath);
ZipOutputStream zipOutput = new ZipOutputStream(fileOutput);
for (int i = 0; i < filePaths.size(); i++) {
File file = new File(filePaths.get(i));
if (file.exists() && !file.isDirectory()) {
InputStream input = new FileInputStream(file);
ZipEntry entry = new ZipEntry(fileNames.get(i));
zipOutput.putNextEntry(entry);
int length = 0;
while ((length = input.read()) != -1) {
zipOutput.write(length);
}
input.close();
}
}
zipOutput.setEncoding("GBK");
zipOutput.flush();
zipOutput.closeEntry();
zipOutput.close();
fileOutput.flush();
fileOutput.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
补充:Java , Java EE