title: Extracting Tomcat Zip SOMETIMES fail with IOException: Negative seek offset
body: <p>I am using maven cargo with its zip url installer feature to download a tomcat for my integration tests. This works fine on my computer, but when its run in husdon it fails sometimes (round about 10-20%).</p>
  
  <p>The failure is:</p>
  
  <pre><code>Error while expanding /home/hudson/workspace/My Test Media-Archive/cfma/target/cargo/install/apache-tomcat-6.0.32.zip
  java.io.IOException: Negative seek offset
      at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:148)
      at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:107)
      at org.codehaus.cargo.container.installer.ZipURLInstaller.unpack(ZipURLInstaller.java:252)
      at org.codehaus.cargo.container.installer.ZipURLInstaller.install(ZipURLInstaller.java:149)
      at org.codehaus.cargo.maven2.configuration.Container.setupHome(Container.java:357)
      at org.codehaus.cargo.maven2.configuration.Container.createContainer(Container.java:241)
      at org.codehaus.cargo.maven2.AbstractCargoMojo.createNewContainer(AbstractCargoMojo.java:470)
      at org.codehaus.cargo.maven2.AbstractCargoMojo.createContainer(AbstractCargoMojo.java:410)
      at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStartMojo.java:53)
      at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:268)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at hudson.maven.agent.Main.launch(Main.java:173)
      at hudson.maven.MavenBuilder.call(MavenBuilder.java:164)
      at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:861)
      at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:792)
      at hudson.remoting.UserRequest.perform(UserRequest.java:114)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:270)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: java.io.IOException: Negative seek offset
      at java.io.RandomAccessFile.seek(Native Method)
      at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:403)
      at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:271)
      at org.apache.tools.zip.ZipFile.&lt;init&gt;(ZipFile.java:152)
      at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:137)
      ... 40 more
  --- Nested Exception ---
  java.io.IOException: Negative seek offset
      at java.io.RandomAccessFile.seek(Native Method)
      at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:403)
      at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:271)
      at org.apache.tools.zip.ZipFile.&lt;init&gt;(ZipFile.java:152)
      at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:137)
      at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:107)
      at org.codehaus.cargo.container.installer.ZipURLInstaller.unpack(ZipURLInstaller.java:252)
      at org.codehaus.cargo.container.installer.ZipURLInstaller.install(ZipURLInstaller.java:149)
      at org.codehaus.cargo.maven2.configuration.Container.setupHome(Container.java:357)
      at org.codehaus.cargo.maven2.configuration.Container.createContainer(Container.java:241)
      at org.codehaus.cargo.maven2.AbstractCargoMojo.createNewContainer(AbstractCargoMojo.java:470)
      at org.codehaus.cargo.maven2.AbstractCargoMojo.createContainer(AbstractCargoMojo.java:410)
      at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStartMojo.java:53)
      at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:268)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at hudson.maven.agent.Main.launch(Main.java:173)
      at hudson.maven.MavenBuilder.call(MavenBuilder.java:164)
      at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:861)
      at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:792)
      at hudson.remoting.UserRequest.perform(UserRequest.java:114)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:270)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>And this is the relevant part of my pom.</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
    &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.0.5&lt;/version&gt;
    &lt;configuration&gt;
       &lt;container&gt;
           &lt;zipUrlInstaller&gt;
      &lt;url&gt;http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip&lt;/url&gt;
            &lt;zipUrlInstaller&gt;
            .... 
       &lt;/container&gt;
       ...
     &lt;configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Does anybody know what I am doing wrong?</p>