HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavaMinor

org.jenkinsci.lib.envinject.EnvInjectException: java.io.IOException: remote file operation failed

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
fileioexceptionlibenvinjectexceptionjenkinscijavaenvinjectoperationfailedremote

Problem

I've the following error in Jenkins console when running job which uses Windows slave:

Started by user 
  [EnvInject] - Loading node environment variables.
 ERROR: SEVERE ERROR occurs
 org.jenkinsci.lib.envinject.EnvInjectException: java.io.IOException: remote file operation failed: C:\Program Files\Java\jre1.8.0_91 at hudson.remoting.Channel@2f4af34f:Management VPC Slave: Windows (sir-rvhi7z8q): java.io.IOException: Unable to delete 'C:\Program Files\Java\jre1.8.0_91\bin\awt.dll'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
 at org.jenkinsci.plugins.envinject.util.RunHelper.getBuildVariables(RunHelper.java:137)
 at org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironmentWithoutJobPropertyObject(EnvInjectListener.java:236)
 at org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironment(EnvInjectListener.java:50)
 at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:534)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:454)
 at hudson.model.Run.execute(Run.java:1737)
...
 Caused by: java.io.IOException: remote file operation failed: C:\Program Files\Java\jre1.8.0_91 at hudson.remoting.Channel@2f4af34f:Management VPC Slave: Windows (sir-rvhi7z8q): java.io.IOException: Unable to delete 'C:\Program Files\Java\jre1.8.0_91\bin\awt.dll'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
 at hudson.FilePath.act(FilePath.java:994)
 at hudson.FilePath.act(FilePath.java:976)
...
 Caused by: java.io.IOException: Unable to delete 'C:\Program Files\Java\jre1.8.0_91\bin\awt.dll'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
 at hudson.Util.deleteFile(Util.java:250)
 at hudson.FilePath.deleteRecursive(FilePath.java:1211)
...
Caused by: java.nio.file.AccessDeniedException: C:\Program Files\Java\jre1.8.0_91\bin\awt.dll
 at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)


which stops the job at the very start.

I've

Solution

The EnvInject plugin is basically attempting to load the build environment which uses configuration of JDK tools in Jenkins which fails during reinstallation of Java JDK library on the Windows slave (as per given configuration).

This JDK configuration can be found in Global Tool Configuration (at /configureTools) for the given JDK profile which was selected in that job configuration. The installation process failed to reinstall Java JDK due to running Java process in the background (such as java -jar slave.jar) which was using these DLL files.

So it sounds like it's not possible to reinstall the same Java JDK files which are used to run the Jenkins slave process.

The solution was to disable Install automatically option in Global Tool Configuration, as Java JDK was already installed on that slave.

Related: JENKINS-46989 - EnvInjectException: remote file operation failed.

Context

StackExchange DevOps Q#2159, answer score: 5

Revisions (0)

No revisions yet.