Jenkins错误:java.io.IOException:error = 13,Permission denied

时间:2015-09-24 09:55:48

标签: java jenkins

我正在尝试使用maven构建Jenkins1.58项目 每件事看起来都很好但是,当我构建项目时,我收到了这个错误。

  

java.io.IOException:error = 13,Permission denied

控制台日志



Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/SpringHelloWorld3/workspace
 > /usr/local/git/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /usr/local/git/bin/git config remote.origin.url git@bitbucket.org:DrunkenCooder/spring3helloworld.git # timeout=10
Fetching upstream changes from git@bitbucket.org:DrunkenCooder/spring3helloworld.git
 > /usr/local/git/bin/git --version # timeout=10
 > /usr/local/git/bin/git -c core.askpass=true fetch --tags --progress git@bitbucket.org:DrunkenCooder/spring3helloworld.git +refs/heads/*:refs/remotes/origin/*
 > /usr/local/git/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > /usr/local/git/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision b148eb99dead9a288afb0c9e6f6e87ae7aa133fe (refs/remotes/origin/master)
 > /usr/local/git/bin/git config core.sparsecheckout # timeout=10
 > /usr/local/git/bin/git checkout -f b148eb99dead9a288afb0c9e6f6e87ae7aa133fe
 > /usr/local/git/bin/git rev-list b148eb99dead9a288afb0c9e6f6e87ae7aa133fe # timeout=10
Parsing POMs
[workspace] $ /home/qaserver3/app/jdk1.6.0_45/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3/conf/logging jenkins.maven3.agent.Maven31Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.47.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 50233
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/home/qaserver3/app/jdk1.6.0_45/bin/java" (in directory "/var/lib/jenkins/jobs/SpringHelloWorld3/workspace"): error=13, Permission denied
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	at hudson.Proc$LocalProc.<init>(Proc.java:244)
	at hudson.Proc$LocalProc.<init>(Proc.java:216)
	at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
	at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:266)
	at hudson.maven.ProcessCache.get(ProcessCache.java:236)
	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:755)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
	at hudson.model.Run.execute(Run.java:1759)
	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
	at hudson.model.ResourceController.execute(ResourceController.java:89)
	at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: error=13, Permission denied
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
	at java.lang.ProcessImpl.start(ProcessImpl.java:130)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
	... 12 more
Finished: FAILURE
&#13;
&#13;
&#13;

I am using `Java 1.6_45` and I installed java using `.bash_profile`
and when I run `java -version` I get 
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

我还修改了超级用户下的.bash_profile。 我已经将所有权限更改为775递归的java文件夹。

但我仍然遇到上述问题。 任何人都可以指导我解决这个问题。

2 个答案:

答案 0 :(得分:1)

如果Jenkins以非root用户身份运行,那么最可能的问题是java可执行文件(或父目录)上的权限不正确。

如果Jenkins以root身份运行(这是一个坏主意!)那么我的猜测是这是SELinux访问控制的问题。

答案 1 :(得分:0)

这显然是一个权限问题。

在Windows计算机上开发代码并在jenkins(Linux或ubuntu)上进行构建时。

在Git Bash上运行此命令以更改权限

git update-index --chmod=+x some_shell_script.sh

此处x授予执行权限

然后执行git push

相关问题