java.util.zip.ZipException:打开spring-webmvc-3.0.7.RELEASE.jar的zip文件时出错

时间:2016-03-12 19:20:22

标签: java spring spring-mvc

在分析WSO2 Application Server 5.3.1-SNAPSHOT的Jenkins构建的构建日志时,我遇到了在部署spring3-restful-jndi-service.war时发生的以下异常。

org.wso2.appserver.integration.tests.webapp.spring.SpringExplodeWebAppDeploymentTestCase.testWebApplicationExplodedDeployment ===================
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - [2016-03-10 07:00:26,295]  WARN {org.apache.tomcat.util.scan.StandardJarScanner} -  Failed to scan JAR [file:/build/jenkins-home/workspace/product-as/modules/integration/tests-integration/tests/target/carbontmp1457572872966/wso2as-5.3.1-SNAPSHOT/repository/deployment/server/webapps/spring3-restful-jndi-service/WEB-INF/lib/spring-webmvc-3.0.7.RELEASE.jar] from WEB-INF/lib
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - java.util.zip.ZipException: error in opening zip file
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at java.util.zip.ZipFile.open(Native Method)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at java.util.zip.ZipFile.<init>(ZipFile.java:215)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at java.util.zip.ZipFile.<init>(ZipFile.java:145)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at java.util.jar.JarFile.<init>(JarFile.java:153)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at java.util.jar.JarFile.<init>(JarFile.java:90)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:99)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at org.apache.tomcat.util.scan.FileUrlJar.<init>(FileUrlJar.java:41)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:34)
INFO  [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -   at org.apache.catalina.startup.ContextConfig$FragmentJarScannerCallback.scan(ContextConfig.java:2647)

此处提及的集成测试案例如下:

@DataProvider
    private static WebAppMode[][] webAppModeProvider() {
        return new WebAppMode[][] {
                new WebAppMode[] { new WebAppMode(SPRING3JNDIAPP, TestUserMode.SUPER_TENANT_ADMIN) },
                new WebAppMode[] { new WebAppMode(SPRING3JNDIAPP, TestUserMode.TENANT_USER) },
                new WebAppMode[] { new WebAppMode(SPRING4JNDIAPP, TestUserMode.SUPER_TENANT_ADMIN) },
                new WebAppMode[] { new WebAppMode(SPRING4JNDIAPP, TestUserMode.TENANT_USER) }, };
    }

    @SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
    @BeforeClass(alwaysRun = true)
    public void init() throws Exception {
        super.init();
        webAppURL = getWebAppURL(WebAppTypes.WEBAPPS);
        createTable();
        createDataSource(webAppMode.getWebAppName(), sqlDataSource);
        webAppDeploymentDir =
                System.getProperty(ServerConstants.CARBON_HOME) + File.separator + "repository" + File.separator +
                        "deployment" + File.separator + "server" + File.separator + "webapps" + File.separator;
    }

    @SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
    @Test(groups = "wso2.as", description = "Deploying exploded web application file to deployment directory")
    public void testWebApplicationExplodedDeployment() throws Exception {
        String source = ASIntegrationConstants.TARGET_RESOURCE_LOCATION + "spring" + File.separator +
                webAppMode.getWebAppName() + ".war";

        ArchiveExtractor archiveExtractor = new ArchiveExtractor();
        archiveExtractor.extractFile(source, webAppDeploymentDir + File.separator + webAppMode.getWebAppName());
        assertTrue(WebAppDeploymentUtil.isWebApplicationDeployed(backendURL, sessionCookie, webAppMode.getWebAppName()),
                "Web Application Deployment failed");
    }

但是当我从Jenkins获得org.wso2.appserver.integration.tests-5.3.1-SNAPSHOT-tests.jar并分析了特定的spring-webmvc-3.0.7.RELEASE.jar时,我发现这个jar没有损坏。我为此进行的简单程序测试如下:

public static void main(String[] args) {
        try {
            ZipFile file = new ZipFile(new File("/home/chiranga/Desktop/jenkins/archive/org.wso2.appserver/spring-webmvc-3.0.7.RELEASE.jar"));

            Enumeration<? extends ZipEntry> e = file.entries();
            while(e.hasMoreElements()) {
                ZipEntry entry = e.nextElement();
                System.out.println(entry.getName());
            }
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }

另外一个健康的&#39;这个副本大小相同,内容相同。这实际上是一个间歇性的例外。

是否有其他原因java.util.zip.ZipException: error in opening zip file被弹出?

0 个答案:

没有答案