I had a perfectly working AWS VM, which I duplicated in order to have similar environements for stage and production.
I stopped the VM to create a snapshot, but now, when I launch a build with the jenkins slave on it, I get this error :
Building remotely on <nodename> in workspace /home/ubuntu/workspace/<workspaceName>
Installing JDK
java.io.IOException: Unable to find JDK with ID=
at hudson.tools.JDKInstaller.locate(JDKInstaller.java:422)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:134)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:205)
at hudson.model.JDK.forNode(JDK.java:130)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:355)
at hudson.model.Run.getEnvironment(Run.java:2228)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:932)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:828)
at hudson.scm.SCM.checkout(SCM.java:484)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1274)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:531)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Finished: FAILURE
Alternatively, I sometimes got this precision
(between "Installing JDK" and "java.io.IOException: Unable to find JDK with ID=")
FATAL: Failed to get Environment Vars from build
java.lang.RuntimeException: Failed to get Environment Vars from build
at jenkins.plugins.publish_over.BPPlugin.getEnvironmentVariables(BPPlugin.java:84)
at jenkins.plugins.publish_over.BPPlugin.perform(BPPlugin.java:93)
at jenkins.plugins.publish_over_ssh.BapSshPreBuildWrapper.setUp(BapSshPreBuildWrapper.java:64)
at hudson.model.Build$BuildExecution.doRun(Build.java:154)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
I didn't notice what causes those extra lines to appear, since I tried everything I thought about, including
JDK is already here, of course. Everything worked just fine before this reboot. So my first question is "Why does it try to install a JDK ?"
I have no idea about the "Environment Vars" it's trying to get, and am not aware of any change in the VM config, so I'm quite out of ideas.
Looks like the problem was "just" that the configured JDK setting value disappeared from Jenkins.
I have absolutely no idea WHY it did, since no one would have modified this setting, and it's in a submenu which needs to be opened first, making it protected from manipulation mistakes.
Anyway, here's how I fixed it. It's as simple as setting the JAVA_HOME value in Jenkins:
• Go to Manage Jenkins -> Configure system
• Click on "Installations JDK"
• Untick "install automatically" (My environnement was already set up, I just needed to set the variable again)
• Set JAVA_HOME (in my case, /usr/lib/jvm/java-7-openjdk-amd64
), and optionally, name your install
EDIT : since some other builds continued to fail, I had to create a symlink on one of my older servers, which had java installed in /usr/bin/java
mkdir -p /usr/lib/jvm/java-7-openjdk-amd64/bin/
ln -s /usr/bin/java /usr/lib/jvm/java-7-openjdk-amd64/bin/java
I also added a JAVA_HOME environment variable with the same /usr/lib/jvm/java-7-openjdk-amd64
value in Jenkin's conf. Probably redundant
Our Jenkins version is 1.609.3 (checked in /var/lib/jenkins/config.xml
),
Please, comment if you experience the same problem, since I really doubt this mistake originated from a user.