Question

I'm trying to pull from a CVS repository from Jenkins on a Solaris box. Jenkins is running under Tomcat and CVS is on the same machine as Jenkins and Tomcat. When I try to set up a Jenkins job that pulls from CVS it fails with the following stack trace:

Building in workspace /home/tomcat/.jenkins/jobs/compile xml/workspace
cvs checkout -P -D 23 May 2013 15:49:46 -0800 -d workspace xml 
ERROR: CVS Authentication failed: Connection error
org.netbeans.lib.cvsclient.connection.AuthenticationException: Connection error
at org.netbeans.lib.cvsclient.connection.LocalConnection.openConnection(LocalConnection.java:102)
at org.netbeans.lib.cvsclient.connection.LocalConnection.open(LocalConnection.java:145)
at org.netbeans.lib.cvsclient.Client$1.run(Client.java:374)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Cannot run program "cvs": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at org.netbeans.lib.cvsclient.connection.LocalConnection.openConnection(LocalConnection.java:95)
... 3 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 7 more
ERROR: Cvs task failed

It looks to me that Jenkins can't find cvs. When I log in as tomcat and type cvs, the command works. If I create a job in Jenkins and run the cvs command from the shell task, the command works. If I echo environment variables, such as PATH or CVSROOT, I get the expected results.

Where does Jenkins look for cvs? How can I set its path so it can see cvs?

-Update-

This looks similar: https://issues.jenkins-ci.org/browse/JENKINS-12633 but I have cvs installed on the server

Was it helpful?

Solution

The problem ended up being that Jenkins was getting its path from tomcat and tomcat was not getting the same path as the tomcat user (I assume because I'm starting tomcat as a service). I solved this by adding the following to the beginning of catalina.sh

PATH=$PATH:/path/to/cvs
export PATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top