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

Unsupported major.minor version 52.0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      While the installation works with Jenkins plugin version 4.0.2

      it gives "Unsupported major.minor version 52.0" error when using the 5.0.x version.

      Jenkins job is set to use the Oracle JDK, but on the slave the default JDK it OpenJDK 1.8.0.222.

       

      It seems the Dependency Check plugin is also using the job defined JDK ?

       
      [DependencyCheck] Exception in thread "main" java.lang.UnsupportedClassVersionError: org/owasp/dependencycheck/App : Unsupported major.minor version 52.0*14:56:46* [DependencyCheck] at java.lang.ClassLoader.defineClass1(Native Method)14:56:46 [DependencyCheck] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)14:56:46 [DependencyCheck] at java.lang.ClassLoader.defineClass(ClassLoader.java:621)14:56:46 [DependencyCheck] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)14:56:46 [DependencyCheck] at java.net.URLClassLoader.defineClass(URLClassLoader.java:304)14:56:46 [DependencyCheck] at java.net.URLClassLoader.access$000(URLClassLoader.java:56)14:56:46 [DependencyCheck] at java.net.URLClassLoader$1.run(URLClassLoader.java:218)14:56:46 [DependencyCheck] at java.security.AccessController.doPrivileged(Native Method)14:56:46 [DependencyCheck] at java.net.URLClassLoader.findClass(URLClassLoader.java:211)14:56:46 [DependencyCheck] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)14:56:46 [DependencyCheck] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)14:56:46 [DependencyCheck] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)14:56:46 [DependencyCheck] Could not find the main class: org.owasp.dependencycheck.App. Program will exit.14:56:48 Build step 'Invoke Dependency-Check' changed build result to FAILURE

        Attachments

          Activity

          Hide
          sspringett Steve Springett added a comment -

          This is an environment issue unrelated to the Jenkins plugin. Once the Jenkins plugin makes the call to dependency-check.bat or dependency-check.sh, the resulting execution or failure to execute is not within its control.

           

          In my experience, some environments with multiple versions of Java installed (especially Java 9/10/11) have this issue. It might be necessary to modify the environment or modify the dependency-check scripts themselves to specify JAVA_HOME.

          Show
          sspringett Steve Springett added a comment - This is an environment issue unrelated to the Jenkins plugin. Once the Jenkins plugin makes the call to dependency-check.bat or dependency-check.sh, the resulting execution or failure to execute is not within its control.   In my experience, some environments with multiple versions of Java installed (especially Java 9/10/11) have this issue. It might be necessary to modify the environment or modify the dependency-check scripts themselves to specify JAVA_HOME.
          Hide
          apontikakis anestis pontikakis added a comment -

          Would it be a good solution to pass the JDK to be used as configuration parameter in the Jenkins job ?

          The alternative for us is to create a separate job to just invoke the dependency-check, which create more administrative overhead of maintaining an extra job,

           

          Thank you for your prompt reply!

          Show
          apontikakis anestis pontikakis added a comment - Would it be a good solution to pass the JDK to be used as configuration parameter in the Jenkins job ? The alternative for us is to create a separate job to just invoke the dependency-check, which create more administrative overhead of maintaining an extra job,   Thank you for your prompt reply!
          Hide
          sspringett Steve Springett added a comment -

          Using the environment injector plugin and specifying JAVA_HOME does work on freestyle builds. Haven't tried on pipeline.

          Show
          sspringett Steve Springett added a comment - Using the environment injector plugin and specifying JAVA_HOME does work on freestyle builds. Haven't tried on pipeline.
          Hide
          apontikakis anestis pontikakis added a comment -

          For documentation: I have injected the following  variable, which is picked up by the "dependency-check.sh" :  JAVACMD=/MyJdkDir/bin/java

          This way it does not affect other build steps that require a different JDK, to facilitate legacy applications.

          For future reference(New Feature) an extension of the Dependency-Check plugin to point which JDK installation to-be-used would be a plus.

          A similar effort has been done in the "sonar-scanner-jenkins".

           

          Thank you for the pointers Steve!

          Show
          apontikakis anestis pontikakis added a comment - For documentation: I have injected the following  variable, which is picked up by the "dependency-check.sh" :  JAVACMD=/MyJdkDir/bin/java This way it does not affect other build steps that require a different JDK, to facilitate legacy applications. For future reference(New Feature) an extension of the Dependency-Check plugin to point which JDK installation to-be-used would be a plus. A similar effort has been done in the "sonar-scanner-jenkins".   Thank you for the pointers Steve!

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            apontikakis anestis pontikakis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: