• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Version: 2.235.3
      Running on Docker
      Running a bitbucket multibranch pipeline

      The problem occurs in 2.235.1 as well, but it didn't happen 1-2 days and nothing I know has changed

      I have a problem where if I have a globally configured shared library and I want to use it in a build I get the following error:

      java.lang.NullPointerException
        at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:171)
        at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:154)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
        at hudson.security.ACL.impersonate(ACL.java:367)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

      One workaround is to delete the library '...' line from the Jenkinsfile and make the shared lib implicitly included
      The Jenkinsfile in question looks like this:
      library 'tsc-pipelines@master'
      java()

          [JENKINS-63355] NullPointerException while loading library

          I found the problem. I added a library to the multibranch pipeline, which I didn't give a name. The LibraryStep was iterating through this and the name was null.

          Maybe it would be a good idea to not let the user save the configuration if there isn't a valid name entered to the pipeline

          László Stahorszki added a comment - I found the problem. I added a library to the multibranch pipeline, which I didn't give a name. The LibraryStep was iterating through this and the name was null. Maybe it would be a good idea to not let the user save the configuration if there isn't a valid name entered to the pipeline

          David S added a comment - - edited

          I'm facing exactly the same issue since a couple of days, however our jenkinsfile was last changed over 3 years ago and all shared libs have a name in the configuration, so I don't know why this happens.

          But the line of the stacktrace matches your description of the issue:

          java.lang.NullPointerException
          {{ at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:175)}}
          {{ at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:155)}}
          {{ at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)}}
          {

          { at hudson.security.ACL.impersonate2(ACL.java:451)}

          }

           

          Update: 

          I did some more testing, the issue only appears when using multibranch builds.

          When including the same repo/jenkinsfile in a single pipeline job it works fine.

          I'm using Jenkins 2.337

           

          Update 2:
          Found the root cause, when configuring a folder and clicking on "Pipeline Libraries -> Add" you can save the settings with all fields being empty causing the issue described

          David S added a comment - - edited I'm facing exactly the same issue since a couple of days, however our jenkinsfile was last changed over 3 years ago and all shared libs have a name in the configuration, so I don't know why this happens. But the line of the stacktrace matches your description of the issue: java.lang.NullPointerException {{ at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:175)}} {{ at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:155)}} {{ at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)}} { { at hudson.security.ACL.impersonate2(ACL.java:451)} }   Update:  I did some more testing, the issue only appears when using multibranch builds. When including the same repo/jenkinsfile in a single pipeline job it works fine. I'm using Jenkins 2.337   Update 2: Found the root cause, when configuring a folder and clicking on "Pipeline Libraries -> Add" you can save the settings with all fields being empty causing the issue described

            Unassigned Unassigned
            rolaca11 László Stahorszki
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: