跳至主要內容

[java] Maven引入jar包后报错:java.util.zip.ZipException: error in opening zip file

問題描述

[INFO] Running war on http://localhost:8080/demo_uploadify
[INFO] Using existing Tomcat server configuration at D:\workspace\demo_uploadify\target\tomcat
2014-8-4 15:51:40 org.apache.catalina.startup.Embedded start
信息: Starting tomcat server
2014-8-4 15:51:40 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.29
2014-8-4 15:51:40 org.apache.catalina.startup.TldConfig tldScanJar
严重: Exception processing JAR at resource path D:\.m2\repository\org\slf4j\slf4j-api\1.7.5\slf4j-api-1.7.5.jar in context /demo_uploadify
java.util.zip.ZipException: error in opening zip file
  at java.util.zip.ZipFile.open(Native Method)
  at java.util.zip.ZipFile.(ZipFile.java:127)
  at java.util.jar.JarFile.(JarFile.java:136)
  at java.util.jar.JarFile.(JarFile.java:100)
  at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:346)
  at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:273)
  at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:634)
  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4540)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
  at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
  at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
  at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
  at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
  at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

解决方法:
删除問題包slf4j-api-1.7.5.jar所在的目录D:\.m2\repository\org\slf4j\slf4j-api\1.7.5,然后重新build即可。同類問题都可以使用此方法解决。
Maven引入jar包后报错:java.util.zip.ZipException: error in opening zip file

分類:java
由 Compete Themes 設計的 Author 佈景主題