Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55475

AntClassLoader doesn't report corrupted files

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: jenkins-test-harness
    • Labels:
      None
    • Environment:
      Windows, Eclipse Photon
    • Similar Issues:

      Description

      I try to update my plugin from old org.jenkins-ci.plugins:plugin:1.509.2 API to newer org.jenkins-ci.plugins:plugin:3.4.

      I get an error during test when calling "mvn install" in org.jvnet.hudson.test.PluginAutomaticTestBuilder$OtherTests.testPluginActive.

      It seems there is something like a corrupt JAR file, but I don't know which. Starting Maven with debug doesn't stop at breakpoints and AntClassLoader doens't report which JAR file can't be opened. How can I find the corrupt file without debugging? I would like AntClassLoader to report the zip file name.

       

      INFO] -------------------------------------------------------
      [INFO] T E S T S
      [INFO] -------------------------------------------------------
      [INFO] Running InjectedTest
      [ERROR] Tests run: 12, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 13.895 s <<< FAILURE! - in InjectedTest
      [ERROR] testPluginActive(org.jvnet.hudson.test.PluginAutomaticTestBuilder$OtherTests) Time elapsed: 0.007 s <<< ERROR!
      java.lang.Error: Plugin the.jpl failed to start
      at org.jvnet.hudson.test.PluginAutomaticTestBuilder$OtherTests.testPluginActive(PluginAutomaticTestBuilder.java:99)
      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)

      ...

      Caused by: java.util.zip.ZipException: error in opening zip file
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.<init>(ZipFile.java:225)
      at java.util.zip.ZipFile.<init>(ZipFile.java:155)
      at java.util.jar.JarFile.<init>(JarFile.java:166)
      at java.util.jar.JarFile.<init>(JarFile.java:130)
      at jenkins.util.AntClassLoader.addPathFile(AntClassLoader.java:503)
      at jenkins.util.AntWithFindResourceClassLoader.addPathFiles(AntWithFindResourceClassLoader.java:35)

      ...

       

        Attachments

          Activity

          Hide
          marco_jacob Marco Jacob added a comment -

          Is there anything I can do to get this InjectedTests running?

          Am am stuck just to -DskipsTests.

          Show
          marco_jacob Marco Jacob added a comment - Is there anything I can do to get this InjectedTests running? Am am stuck just to -DskipsTests.
          Hide
          olivergondza Oliver Gondža added a comment -

          Can you reproduce this from scratch? Meaning building from clean git checkout...

          Show
          olivergondza Oliver Gondža added a comment - Can you reproduce this from scratch? Meaning building from clean git checkout...
          Hide
          marco_jacob Marco Jacob added a comment - - edited

          Running "mvn clean install" has the same results.
          Clean checkout my own plugin and build from scratch has the same results.

          Workaround:

            Configure maven-hpi-plugin set disabledTestInjection=true.

          I'm not sure why the InjectedTests fail because I can't get the JAR name from the StackTrace mentioned above.
          That is the main reason for this.

          Show
          marco_jacob Marco Jacob added a comment - - edited Running "mvn clean install" has the same results. Clean checkout my own plugin and build from scratch has the same results. Workaround:   Configure maven-hpi-plugin set disabledTestInjection=true. I'm not sure why the InjectedTests fail because I can't get the JAR name from the StackTrace mentioned above. That is the main reason for this.
          Hide
          olivergondza Oliver Gondža added a comment -

          Anything interesting in /target/surefire-reports/InjectedTest-output.txt? I suspect there might be broken dependency cached in ~/.m2/repository - it can be verified by either strace or rerunning with different maven home location.

          Show
          olivergondza Oliver Gondža added a comment - Anything interesting in /target/surefire-reports/InjectedTest-output.txt? I suspect there might be broken dependency cached in ~/.m2/repository - it can be verified by either strace or rerunning with different maven home location.
          Hide
          marco_jacob Marco Jacob added a comment -

          Yes, found it:

          SEVERE: Failed Inspecting plugin C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\the.jpl
          java.util.zip.ZipException: error in opening zip file

          Jan 30, 2019 7:31:08 AM jenkins.InitReactorRunner$1 onTaskFailed
          SEVERE: Failed Inspecting plugin C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\credentials.jpi
          java.io.IOException: Failed to expand C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\credentials.jpi
          at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:632)

          Caused by: Error while expanding C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\credentials.jpi
          java.util.zip.ZipException: archive is not a ZIP archive
          at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:190)

          Caused by: java.util.zip.ZipException: archive is not a ZIP archive
          at org.apache.tools.zip.ZipFile.positionAtEndOfCentralDirectoryRecord(ZipFile.java:771)
          at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:707)
          at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:452)
          at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:214)
          at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:168)

           

          Full file: InjectedTest-output.txt

           

           

          Show
          marco_jacob Marco Jacob added a comment - Yes, found it: SEVERE: Failed Inspecting plugin C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\the.jpl java.util.zip.ZipException: error in opening zip file Jan 30, 2019 7:31:08 AM jenkins.InitReactorRunner$1 onTaskFailed SEVERE: Failed Inspecting plugin C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\credentials.jpi java.io.IOException: Failed to expand C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\credentials.jpi at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:632) Caused by: Error while expanding C:\Entwicklung\TRUNK-Photon\ee_jenkins\ee_jenkins_deploy_plugin\target\tmp\jenkins702521110614006407\credentials.jpi java.util.zip.ZipException: archive is not a ZIP archive at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:190) Caused by: java.util.zip.ZipException: archive is not a ZIP archive at org.apache.tools.zip.ZipFile.positionAtEndOfCentralDirectoryRecord(ZipFile.java:771) at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:707) at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:452) at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:214) at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:168)   Full file: InjectedTest-output.txt    
          Hide
          marco_jacob Marco Jacob added a comment -

          The directory jenkins702521110614006407 is not existing in the given directory in tmp after the build is done.

          Show
          marco_jacob Marco Jacob added a comment - The directory jenkins702521110614006407 is not existing in the given directory in tmp after the build is done.

            People

            • Assignee:
              olivergondza Oliver Gondža
              Reporter:
              marco_jacob Marco Jacob
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: