Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.nio.file.AccessDeniedException at Jenkins build

I'm setting up a Jenkins system at MacOSX Server for an automatically build after a svn checkin. But when the build is starting I get these java error at the console output. Does anyone have experience with Jenkins and these error?

Gestartet durch Benutzer anonymous
[EnvInject] - Loading node environment variables.
Baue in Workspace /Users/Shared/Jenkins/Home/jobs/myProject/workspace
Cleaning local Directory .
java.nio.file.AccessDeniedException: /Users/Shared/Jenkins/Home/jobs/my Project/workspace/./.svn/pristine/04/040d4cd4de48d844246c38e096a78718879bfafb.svn-base
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
	at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
	at java.nio.file.Files.delete(Files.java:1126)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at hudson.Util.deleteFile(Util.java:255)
	at hudson.Util.deleteRecursive(Util.java:318)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.Util.deleteRecursive(Util.java:309)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.Util.deleteRecursive(Util.java:309)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.Util.deleteRecursive(Util.java:309)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.scm.subversion.CheckoutUpdater$1.perform(CheckoutUpdater.java:81)
	at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:162)
	at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:988)
	at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:969)
	at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:945)
	at hudson.FilePath.act(FilePath.java:990)
	at hudson.FilePath.act(FilePath.java:968)
	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:894)
	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:830)
	at hudson.scm.SCM.checkout(SCM.java:485)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	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:410)
Sending e-mails to: m...
Finished: FAILURE
like image 249
marcelZ Avatar asked Jan 26 '16 10:01

marcelZ


2 Answers

This problem is occurring because you don't have permission to execute the job on the Jenkins jobs dir (in your case /Users/Shared/Jenkins/Home/jobs) or you don't have permission on the jenkins dir /var/lib/jenkins/.

I got the same problem when I tried to copy the jobs dir from a server to another.

To solve this we need to change the owner of jobs to the jenkins user:

sudo chown -R jenkins:jenkins jobs

If this does no solve, the the problem can be with the permission of your var/lib/jenkins dir:

sudo chown -R jenkins:jenkins /var/lib/jenkins/

This will solve your problem.

ps. Maybe you will need to restart your Jenkins application

like image 92
valdeci Avatar answered Nov 10 '22 05:11

valdeci


Seems like the os user which is running jenkins has no write privileges for either the complete workspace directory or some of the files in the workspace directory.

like image 32
Julien Charon Avatar answered Nov 10 '22 04:11

Julien Charon