java.util.zip.ZipException: invalid LOC header (bad signature)

运行tomcat遇到的一个问题,网上受理很多资料,发现这种方法最有效,记录下来!

Unable to process Jar entry [com/google/zxing/client/j2se/CommandLineRunner.class] from Jar [jar:file:/D:/Program%20Files/Tomcat%207.0/webapps/XLJSSHME/WEB-INF/lib/javase-2.0.jar!/] for annotations
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:679)
	at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:415)
	at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
	at java.io.DataInputStream.readInt(DataInputStream.java:387)
	at org.apache.tomcat.util.bcel.classfile.ClassParser.readID(ClassParser.java:202)
	at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:80)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2089)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1965)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1931)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1916)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)


解决方法:
maeven里有没有这个包,没有的话在pom里添加依赖 javase-2.0.jar然后更新meaven。

然后,打开tomcat/conf/catalina.properties文件,找到 tomcat.util.scan.DefaultJarScanner.jarsToSkip节点,在后面添加 javase-2.0.jar
然后重新启动tomcat,问题解决。

你可能感兴趣的:(java.util.zip.ZipException: invalid LOC header (bad signature))