首页 > 代码库 > invalid LOC header (bad signature)错误与 java.lang.ClassFormatError: com/mysql/jdbc错误

invalid LOC header (bad signature)错误与 java.lang.ClassFormatError: com/mysql/jdbc错误

1,报错信息如下:

SEVERE: Resource read error: Could not load org.springframework.jmx.support.MetricType.
java.util.zip.ZipException: invalid LOC header (bad signature)
<span style="white-space:pre">	</span>at java.util.zip.ZipFile.read(Native Method)
<span style="white-space:pre">	</span>at java.util.zip.ZipFile.access$1400(ZipFile.java:56)
<span style="white-space:pre">	</span>at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:677)
<span style="white-space:pre">	</span>at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:413)
<span style="white-space:pre">	</span>at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:3104)
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2771)
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668)
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
<span style="white-space:pre">	</span>at java.lang.Class.getDeclaredMethods0(Native Method)
<span style="white-space:pre">	</span>at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
<span style="white-space:pre">	</span>at java.lang.Class.getDeclaredMethods(Class.java:1810)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:104)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:101)
<span style="white-space:pre">	</span>at java.security.AccessController.doPrivileged(Native Method)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:100)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:84)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:221)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
<span style="white-space:pre">	</span>at java.lang.reflect.Method.declaredAnnotations(Method.java:699)
<span style="white-space:pre">	</span>at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:692)
<span style="white-space:pre">	</span>at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:196)
<span style="white-space:pre">	</span>at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:161)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:233)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203)
<span style="white-space:pre">	</span>at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:622)
<span style="white-space:pre">	</span>at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
<span style="white-space:pre">	</span>at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
<span style="white-space:pre">	</span>at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
<span style="white-space:pre">	</span>at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
<span style="white-space:pre">	</span>at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
<span style="white-space:pre">	</span>at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
<span style="white-space:pre">	</span>at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
<span style="white-space:pre">	</span>at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
<span style="white-space:pre">	</span>at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
<span style="white-space:pre">	</span>at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
<span style="white-space:pre">	</span>at java.util.concurrent.FutureTask.run(FutureTask.java:166)
<span style="white-space:pre">	</span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
<span style="white-space:pre">	</span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
<span style="white-space:pre">	</span>at java.lang.Thread.run(Thread.java:722)


ERROR 12-31_13:41:08 ContextLoader.java 312 Context initialization failed 
java.lang.NoClassDefFoundError: org/springframework/jmx/support/MetricType
<span style="white-space:pre">	</span>at java.lang.Class.getDeclaredMethods0(Native Method)
<span style="white-space:pre">	</span>at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
<span style="white-space:pre">	</span>at java.lang.Class.getDeclaredMethods(Class.java:1810)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:104)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:101)
<span style="white-space:pre">	</span>at java.security.AccessController.doPrivileged(Native Method)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:100)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:84)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:221)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
<span style="white-space:pre">	</span>at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
<span style="white-space:pre">	</span>at java.lang.reflect.Method.declaredAnnotations(Method.java:699)
<span style="white-space:pre">	</span>at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:692)
<span style="white-space:pre">	</span>at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:196)
<span style="white-space:pre">	</span>at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:161)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:233)
<span style="white-space:pre">	</span>at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203)
<span style="white-space:pre">	</span>at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:622)
<span style="white-space:pre">	</span>at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
<span style="white-space:pre">	</span>at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
<span style="white-space:pre">	</span>at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
<span style="white-space:pre">	</span>at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
<span style="white-space:pre">	</span>at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
<span style="white-space:pre">	</span>at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
<span style="white-space:pre">	</span>at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
<span style="white-space:pre">	</span>at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
<span style="white-space:pre">	</span>at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
<span style="white-space:pre">	</span>at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
<span style="white-space:pre">	</span>at java.util.concurrent.FutureTask.run(FutureTask.java:166)
<span style="white-space:pre">	</span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
<span style="white-space:pre">	</span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
<span style="white-space:pre">	</span>at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.springframework.jmx.support.MetricType
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
<span style="white-space:pre">	</span>at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
<span style="white-space:pre">	</span>... 34 more

2,报错信息如下:

 12-31_12:00:15 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@29579f4e -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (100). Last acquisition attempt exception:
java.sql.SQLException: java.lang.ClassFormatError: com/mysql/jdbc/MysqlIO
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:435)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
    at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)
I 12-31_12:00:15 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@379bcf16 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (100). Last acquisition attempt exception:
java.sql.SQLException: java.lang.ClassFormatError: com/mysql/jdbc/MysqlIO
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:435)


项目运行正常,服务器重启后报错如上1,2所述

解决方法:替换lib下的jar,jar包损坏导致不可读

invalid LOC header (bad signature)错误与 java.lang.ClassFormatError: com/mysql/jdbc错误