ShrinkWrap
  1. ShrinkWrap
  2. SHRINKWRAP-444

Deploy fail on ZipException("error in opening zip file") when ShrinkWrap.createFromZipFile is used

    Details

    • Type: Bug Bug
    • Status: Closed Closed (View Workflow)
    • Priority: Critical Critical
    • Resolution: Done
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.1.2
    • Component/s: None
    • Labels:
      None
    • Bugzilla Update:
      Perform
    • Similar Issues:
      Show 10 results 

      Description

      How to reproduce:
      This bug appeared when deploying war archive into EAP 6.0.1. The archive was created by `ShrinkWrap.createFromZipFile(WebArchive.class, new File("path to war"))`. And it has to contain embedded library, which size is greater than few kilobytes, on tiny sizes it didn't appear.

      My test archive has following structure and size 670kB.

      test.war:
      /WEB-INF/
      /WEB-INF/lib/
      /WEB-INF/lib/hsqldb-1.8.0.10.jar
      /WEB-INF/web.xml
      /WEB-INF/classes/
      /WEB-INF/classes/org/
      /WEB-INF/classes/org/jboss/
      /WEB-INF/classes/org/jboss/wfk/
      /WEB-INF/classes/org/jboss/wfk/test/
      /WEB-INF/classes/org/jboss/wfk/test/arquillian/
      /WEB-INF/classes/org/jboss/wfk/test/arquillian/HelloWorldServlet.class
      

      Stack trace:

      org.jboss.arquillian.container.spi.client.container.DeploymentException: Could not deploy to container: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"stub9.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"stub9.war\".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment \"stub9.war\"
          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018037: Failed to process WEB-INF/lib: \"/content/stub9.war/WEB-INF/lib/hsqldb-1.8.0.10.jar\"
          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018037: Failed to process WEB-INF/lib: \"/content/stub9.war/WEB-INF/lib/hsqldb-1.8.0.10.jar\"
          Caused by: java.util.zip.ZipException: error in opening zip file"}}
      	at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:74)
      	at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:148)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:95)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:80)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:263)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:239)
      	at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:79)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:101)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
      	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
      	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
      	at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
      	at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"stub9.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"stub9.war\".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment \"stub9.war\"
          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018037: Failed to process WEB-INF/lib: \"/content/stub9.war/WEB-INF/lib/hsqldb-1.8.0.10.jar\"
          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018037: Failed to process WEB-INF/lib: \"/content/stub9.war/WEB-INF/lib/hsqldb-1.8.0.10.jar\"
          Caused by: java.util.zip.ZipException: error in opening zip file"}}
      	at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134)
      	at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123)
      	at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85)
      	at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42)
      	at org.jboss.as.arquillian.container.ArchiveDeployer.executeDeploymentPlan(ArchiveDeployer.java:91)
      	at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:58)
      	... 88 more
      

        Activity

        Hide
        RH Bugzilla Integration
        added a comment -

        Karel Piwko <kpiwko@redhat.com> made a comment on bug 918442

        This is a tracking issues for eventual ShrinkWrap update to WFK 2.3.0. It does not affect any of the WFK releases out there.

        Show
        RH Bugzilla Integration
        added a comment - Karel Piwko <kpiwko@redhat.com> made a comment on bug 918442 This is a tracking issues for eventual ShrinkWrap update to WFK 2.3.0. It does not affect any of the WFK releases out there.
        Hide
        Karel Piwko
        added a comment -

        Michal Matloka here is a SHRINKWRAP-433 related bug you asked for.

        Show
        Karel Piwko
        added a comment - Michal Matloka here is a SHRINKWRAP-433 related bug you asked for.
        Hide
        Michal Matloka
        added a comment - - edited

        I was able to reproduce bug (on jboss-as 7.1.3).

        The following test passes:

        @RunWith(Arquillian.class)
        public class MyWorkingTest {
        
            @Deployment
            public static WebArchive createDeployment() {
                return ShrinkWrap
                        .create(WebArchive.class)
                        .add(
                                new FileAsset(
                                        new File(
                                                "src\\test\\resources\\hsqldb-1.8.0.10.jar")),
                                "/WEB-INF/lib/hsqldb-1.8.0.10.jar");
            }
        
            @Test
            public void empty() {
        
            }
        }
        

        And the following does not:

        @RunWith(Arquillian.class)
        public class MyNotWorkingTest {
        
            @Deployment
            public static WebArchive createDeployment() {
                ShrinkWrap
                        .create(WebArchive.class)
                        .add(
                                new FileAsset(
                                        new File(
                                                "src\\test\\resources\\hsqldb-1.8.0.10.jar")),
                                "/WEB-INF/lib/hsqldb-1.8.0.10.jar").as(ZipExporter.class).exportTo(new File("target\\testABC.war"), true);
                return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target\\testABC.war"));
            }
        
            @Test
            public void empty() {
        
            }
        }
        

        But manual deployment of testABC.war produced during second test does work, so problem lies probably somewhere around createFromZipFile.

         ShrinkWrap
                        .create(WebArchive.class)
                        .add(
                                new FileAsset(
                                        new File(
                                                "src\\test\\resources\\hsqldb-1.8.0.10.jar")),
                                "/WEB-INF/lib/hsqldb-1.8.0.10.jar").as(ZipExporter.class).exportTo(new File("target\\testABC.war"), true);
                ShrinkWrap.createFromZipFile(WebArchive.class, new File("target\\testABC.war")).exportTo(new File("target\\testABC2.war"), true);
        

        testABC.war has 653KB
        testABC2.war has 9KB

        Show
        Michal Matloka
        added a comment - - edited I was able to reproduce bug (on jboss-as 7.1.3). The following test passes: @RunWith(Arquillian.class) public class MyWorkingTest { @Deployment public static WebArchive createDeployment() { return ShrinkWrap .create(WebArchive.class) .add( new FileAsset( new File( "src\\test\\resources\\hsqldb-1.8.0.10.jar" )), "/WEB-INF/lib/hsqldb-1.8.0.10.jar" ); } @Test public void empty() { } } And the following does not: @RunWith(Arquillian.class) public class MyNotWorkingTest { @Deployment public static WebArchive createDeployment() { ShrinkWrap .create(WebArchive.class) .add( new FileAsset( new File( "src\\test\\resources\\hsqldb-1.8.0.10.jar" )), "/WEB-INF/lib/hsqldb-1.8.0.10.jar" ).as(ZipExporter.class).exportTo( new File( "target\\testABC.war" ), true ); return ShrinkWrap.createFromZipFile(WebArchive.class, new File( "target\\testABC.war" )); } @Test public void empty() { } } But manual deployment of testABC.war produced during second test does work, so problem lies probably somewhere around createFromZipFile. ShrinkWrap .create(WebArchive.class) .add( new FileAsset( new File( "src\\test\\resources\\hsqldb-1.8.0.10.jar" )), "/WEB-INF/lib/hsqldb-1.8.0.10.jar" ).as(ZipExporter.class).exportTo( new File( "target\\testABC.war" ), true ); ShrinkWrap.createFromZipFile(WebArchive.class, new File( "target\\testABC.war" )).exportTo( new File( "target\\testABC2.war" ), true ); testABC.war has 653KB testABC2.war has 9KB
        Hide
        Michal Matloka
        added a comment -

        Sorry, my fault. Some types of streams can return less bytes than bufffer can handle, even if there are more data to be returned on next read.

        Show
        Michal Matloka
        added a comment - Sorry, my fault. Some types of streams can return less bytes than bufffer can handle, even if there are more data to be returned on next read.
        Hide
        Andrew Rubinger
        added a comment -

        Good job, Michal. Though your sample is just a bit broken on *nix filesystems; I'll fix it up and push upstream.

        Show
        Andrew Rubinger
        added a comment - Good job, Michal. Though your sample is just a bit broken on *nix filesystems; I'll fix it up and push upstream.
        Show
        Andrew Rubinger
        added a comment - Upstream: https://github.com/shrinkwrap/shrinkwrap/commit/d6ba91e868e3e54d0316c38ba7e95b70822fe3fa and https://github.com/shrinkwrap/shrinkwrap/commit/b2a7dd7324538ce8132a942f576dbc37f49c9b30
        Hide
        RH Bugzilla Integration
        added a comment -

        thradec@redhat.com changed the Status of bug 918442 from NEW to VERIFIED

        Show
        RH Bugzilla Integration
        added a comment - thradec@redhat.com changed the Status of bug 918442 from NEW to VERIFIED
        Hide
        RH Bugzilla Integration
        added a comment -

        thradec@redhat.com made a comment on bug 918442

        verified in shrinkwrap-1.1.2

        Show
        RH Bugzilla Integration
        added a comment - thradec@redhat.com made a comment on bug 918442 verified in shrinkwrap-1.1.2
        Hide
        RH Bugzilla Integration
        added a comment -

        Marek Schmidt <maschmid@redhat.com> changed the Status of bug 918442 from VERIFIED to CLOSED

        Show
        RH Bugzilla Integration
        added a comment - Marek Schmidt <maschmid@redhat.com> changed the Status of bug 918442 from VERIFIED to CLOSED

          People

          • Assignee:
            Andrew Rubinger
            Reporter:
            Tomas Hradec
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: