2017-09-04 79 views
0

其實我有一個問題,我無法解釋。我在測試中遇到下一個異常,它應該通過具體包中的al類,並測試每個人都必須實現的模式函數。無效的LOC頭zipexception

@Test 
    public void testConcreteModels() 
     throws IOException, InstantiationException, IllegalAccessException, NotFoundException, CannotCompileException { 
    // Loop through classes in the model package 
    final ClassLoader loader = Thread.currentThread().getContextClassLoader(); 
    for (final ClassPath.ClassInfo info : ClassPath.from(loader).getTopLevelClassesRecursive(MODEL_PACKAGE)) { 

而且excepcion旁邊....

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:60) 
    at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:734) 
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:434) 
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) 
    at sun.misc.IOUtils.readFully(IOUtils.java:65) 
    at java.util.jar.JarFile.getBytes(JarFile.java:425) 
    at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193) 
    at java.util.jar.JarFile.getManifest(JarFile.java:180) 
    at com.google.common.reflect.ClassPath$Scanner.scanJar(ClassPath.java:375) 
    at com.google.common.reflect.ClassPath$Scanner.scanFrom(ClassPath.java:327) 
    at com.google.common.reflect.ClassPath$Scanner.scan(ClassPath.java:315) 
    at com.google.common.reflect.ClassPath.from(ClassPath.java:92) 
    at com.sancorp.nwe.lcpccr.entity.EntityTest.testConcreteModels(EntityTest.java:40) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 

任何線索如何解決呢????我已經擦拭我的m2存儲庫,以嘗試解決它,但它沒有工作:(

+0

的答案在https://stackoverflow.com/questions/32090921/maven-invalid-loc-header-bad-signature不起作用? – nullpointer

+0

正如我所說的,我多次刪除整個.m2 /存儲庫,乾淨的項目並沒有幫助。 –

+0

我在說這個https://stackoverflow.com/a/41914842/1746118 – nullpointer

回答

0

好吧,經過一些頭痛後,我發現原因。在依賴項中的組件內有一個包同名

儘管沒有匹配的類名稱它試圖解壓縮一個zip文件沒有在我的項目的claspath包...所以它招致一個io異常 - > zipexception等

我認爲它應該是另一種例外,而不是無效的LOC標頭(壞簽名),但改變它的包名似乎是固定的

相關問題