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

ClassNotFound: java.sql.Date in JDK 11 in Pipeline Utility Steps

    • pipeline-utility-steps-2.3.0

      https://github.com/search?q=org%3Ajenkinsci+%22java.sql.Date%22&type=Code 

      In my case I hit it in Pipeline Utility Steps AFAICT

       

      Exception in thread "main" java.lang.NoClassDefFoundError: java.sql.Date at org.apache.commons.beanutils.ConvertUtilsBean.class$(ConvertUtilsBean.java:157) at org.apache.commons.beanutils.ConvertUtilsBean.registerOther(ConvertUtilsBean.java:708) at org.apache.commons.beanutils.ConvertUtilsBean.deregister(ConvertUtilsBean.java:580) at org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:164) at org.kohsuke.stapler.Stapler.<clinit>(Stapler.java:1065) at hudson.model.Node$Mode.<clinit>(Node.java:597) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.base/java.lang.Class.getEnumConstantsShared(Class.java:3554) at java.base/java.lang.Class.getEnumConstants(Class.java:3530) at jenkins.model.Jenkins.<clinit>(Jenkins.java:5191) at hudson.PluginManager.<clinit>(PluginManager.java:1962) at org.jvnet.hudson.test.JenkinsRule.<init>(JenkinsRule.java:325) at io.jenkins.jenkinsfile.runner.JenkinsfileRunnerRule.<init>(JenkinsfileRunnerRule.java:40) at io.jenkins.jenkinsfile.runner.App.run(App.java:18) at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.run(Bootstrap.java:166) at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.main(Bootstrap.java:68)
      

          [JENKINS-54355] ClassNotFound: java.sql.Date in JDK 11 in Pipeline Utility Steps

          Oleg Nenashev added a comment -

          Oleg Nenashev added a comment - FTR https://bugs.openjdk.java.net/browse/JDK-8161269  

          Oleg Nenashev added a comment -

          Oleg Nenashev added a comment - And http://java9.wtf/class-loading/  ...

          I do not believe this is related to pipeline-utility-steps-plugin anymore. I have the same problem with metrics-plugin when solving JENKINS-52017.

          The problem seems that we are using commons-beanutils, which is provided by Jenkins Core and is not Java 9+ compatible and is using java.sql.* classes.

          Adrien Lecharpentier added a comment - I do not believe this is related to pipeline-utility-steps-plugin anymore. I have the same problem with metrics-plugin when solving JENKINS-52017 . The problem seems that we are using commons-beanutils , which is provided by Jenkins Core and is not Java 9+ compatible and is using java.sql.* classes.

          The goal of this very report was to modify the code of pipeline-utility-steps itself to avoid needing java.sql module.

          But given this is used in many places, and you see failures more globally, I think in the short term, we should quite urgently see if adding the java.sql module is enough to not be blocked anymore by this. Because even if we fix pipeline-utility-steps, then many other plugins would fail in production.

          I mean, we'd add java.sql to various places, like:

           

          Baptiste Mathus added a comment - The goal of this very report was to modify the code of pipeline-utility-steps itself to avoid needing java.sql module. But given this is used in many places, and you see failures more globally, I think in the short term, we should quite urgently see if adding the java.sql module is enough to not be blocked anymore by this. Because even if we fix pipeline-utility-steps, then many other plugins would fail in production. I mean, we'd add java.sql to various places, like: https://jenkins.io/blog/2018/12/14/java11-preview-availability/#running-jenkins-war-with-java-11 , and https://github.com/jenkinsci/docker/blob/master/Dockerfile-jdk11#L47 at least  

          I agree. This is out of our reach, as upgrading the library is not enough (latest release performed in 2016). If we wanted to solve this, I guess we'd have to change the library used, which would break many plugins / code as well.

          Adrien Lecharpentier added a comment - I agree. This is out of our reach, as upgrading the library is not enough (latest release performed in 2016). If we wanted to solve this, I guess we'd have to change the library used, which would break many plugins / code as well.

          But let's not mix up things too much.

          I think for the pipeline-utility-steps, reading the code it's about the fact snakeyaml is vendored (yay, so we do Golang, how fancy) and depends on java.sql.Date

          Commented in https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/17

          Baptiste Mathus added a comment - But let's not mix up things too much. I think for the pipeline-utility-steps, reading the code it's about the fact snakeyaml is vendored (yay, so we do Golang, how fancy) and depends on java.sql.Date .  Commented in https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/17

          To check something, I just ran a simple pipeline job to read a yaml structure on jenkins/jenkins:jdk11 and I don't have the same problem at all.

          Adrien Lecharpentier added a comment - To check something, I just ran a simple pipeline job to read a yaml structure on jenkins/jenkins:jdk11 and I don't have the same problem at all.

          So, I can see that the plugin is loading java.sql.Date and java.sql.Timestamp in Tag.java. I can fill a PR to "solve" this, but I cannot prove that it's currently a problem as the latest release of the plugin is in fact running fine in a Jenkins on JDK 11.

          Adrien Lecharpentier added a comment - So, I can see that the plugin is loading java.sql.Date and java.sql.Timestamp in Tag.java . I can fill a PR to "solve" this, but I cannot prove that it's currently a problem as the latest release of the plugin is in fact running fine in a Jenkins on JDK 11.

          I filled a PR to load the classes if they are available and log if they are not.

          This should solve this ticket and let's create another one to track the suspected PCT issue.

          Adrien Lecharpentier added a comment - I filled a PR to load the classes if they are available and log if they are not. This should solve this ticket and let's create another one to track the suspected PCT issue.

          Oleg Nenashev added a comment -

          PCT was fix, and the small patch has been integrated in Pipeline Utility Steps 2.3.0. I think we can just close it

          Oleg Nenashev added a comment - PCT was fix, and the small patch has been integrated in Pipeline Utility Steps 2.3.0. I think we can just close it

            alecharp Adrien Lecharpentier
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: