java.lang.InterruptedException: P4: Unable to setup workspace: java.lang.NullPointerException

Jenkins JIRA | Nick Palmer | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I was attempting to publish assets as a post build action in one of my jobs and didn't realise the perforce server that it would publish to wasn't online. The error I got was not helpful, but a Null Pointer instead: {code:java} ERROR: Publisher 'Perforce: Publish assets' aborted due to exception: java.lang.InterruptedException: P4: Unable to setup workspace: java.lang.NullPointerException at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:63) at org.jenkinsci.plugins.p4.asset.AssetNotifier.perform(AssetNotifier.java:87) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) at hudson.model.Run.execute(Run.java:1769) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) {code} I'm assuming there was a proper error message at some point about not being able to connect to the perforce server but that was lost by a Null Pointer which sent me on a wild goose chase for a while until I realised what was really going on. Looking at the code in AbstractTask.java I'm assuming {{ClientHelper p4 = getConnection();}} doesn't error if it can't get a connection, it just returns null and the code below doesn't check for that first? The catch block does nothing to show the full stack of Exception e, so it's hard to say for sure where the Null Pointer comes from, but that's my guess anyway. Ideally it would throw a {{RuntimeException(err, e);}} instead of the {{InterruptedException(err);}}?

    Jenkins JIRA | 2 years ago | Nick Palmer
    java.lang.InterruptedException: P4: Unable to setup workspace: java.lang.NullPointerException
  2. 0

    I was attempting to publish assets as a post build action in one of my jobs and didn't realise the perforce server that it would publish to wasn't online. The error I got was not helpful, but a Null Pointer instead: {code:java} ERROR: Publisher 'Perforce: Publish assets' aborted due to exception: java.lang.InterruptedException: P4: Unable to setup workspace: java.lang.NullPointerException at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:63) at org.jenkinsci.plugins.p4.asset.AssetNotifier.perform(AssetNotifier.java:87) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) at hudson.model.Run.execute(Run.java:1769) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) {code} I'm assuming there was a proper error message at some point about not being able to connect to the perforce server but that was lost by a Null Pointer which sent me on a wild goose chase for a while until I realised what was really going on. Looking at the code in AbstractTask.java I'm assuming {{ClientHelper p4 = getConnection();}} doesn't error if it can't get a connection, it just returns null and the code below doesn't check for that first? The catch block does nothing to show the full stack of Exception e, so it's hard to say for sure where the Null Pointer comes from, but that's my guess anyway. Ideally it would throw a {{RuntimeException(err, e);}} instead of the {{InterruptedException(err);}}?

    Jenkins JIRA | 2 years ago | Nick Palmer
    java.lang.InterruptedException: P4: Unable to setup workspace: java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.InterruptedException

      P4: Unable to setup workspace: java.lang.NullPointerException

      at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace()
    2. org.jenkinsci.plugins
      AssetNotifier.perform
      1. org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:63)
      2. org.jenkinsci.plugins.p4.asset.AssetNotifier.perform(AssetNotifier.java:87)
      2 frames
    3. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
      4. hudson.model.Build$BuildExecution.post2(Build.java:185)
      5. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
      6. hudson.model.Run.execute(Run.java:1769)
      7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      8. hudson.model.ResourceController.execute(ResourceController.java:98)
      9. hudson.model.Executor.run(Executor.java:374)
      9 frames