See attached screenshot. Please do let me know how to fix this issue ASAP.

enter image description here

  • 4
    can you please post a text-version, please? – SouravGhosh Dec 19 '17 at 6:57
  • Crystal ball says you don't have enough permissions on one of the intermediate directories. Try ls /var/lib/jenkins/…/bsh*.jar and move your way up until it stops failing. – Ulrich Schwarz Dec 19 '17 at 6:59
  • I run this in openshift jenkins pod terminal "java -classpath /var/lib/jenkins/bin;/var/lib/jenkins/lib/* org.testng.TestNG testng.xml" but it shows me a permission denied to error saying "/var/lib/jenkins/CYOV3/lib/bsh-2.0b4.jar". – user266519 Dec 19 '17 at 7:01

You’re talking about

java -classpath /var/lib/jenkins/bin;/var/lib/Jenkins/CYOV3/lib/* org.testng.TestNG testng.xml
as if it were a command, but it’s not — it’s two commands (separated by a ;):

  • java -classpath /var/lib/jenkins/bin, which causes the long usage/error message from java, because it’s an incomplete command,
  • /var/lib/Jenkins/CYOV3/lib/* org.testng.TestNG testng.xml, which globs (does pathname expansion on) the first word (because it contains *) and expands it to something like
    /var/lib/jenkins/CYOV3/lib/bsh-2.0b4.jar /var/lib/Jenkins/CYOV3/lib/foo /var/lib/Jenkins/CYOV3/lib/quux org.testng.TestNG testng.xml
    which fails because /var/lib/jenkins/CYOV3/lib/bsh-2.0b4.jar, being a JAR file (and not a script or a binary executable) doesn’t have execute permission.

You need to figure out what you are trying to do, and then do it correctly.  There’s no way an unquoted, unescaped semicolon (;) can be part of a command.  Do you want to have a space there?  Or maybe a colon (:)?  Figure it out.

  • I tried to execute the command in command prompt in windows and it was working fine using "java -cp C:\Workspace\CYOV3\bin;C:\Workspace\CYOV3\lib* org.testng.TestNG testng.xml" not sure how to do it right via ssh. – user266519 Dec 19 '17 at 8:14
  • 1
    You will need to change the semicolon to a colon on Unix. See this Stackoverflow question – Johan Myréen Dec 19 '17 at 9:00
  • Thanks Johan but how should i do it in Linux? since currently we are using Linux server. – user266519 Dec 19 '17 at 9:26
  • As you're obviously not familiar with the general usage of Linux OS, your best chance is to delegate this to someone who is, e. g. the administrator. Teaching you Unix is far beyond the scope of this question. – Murphy Dec 19 '17 at 10:00

Finally found a fixed. I used the command below and added it as shell command in jenkins job and build it. It is now executing the command. It was found out that it will not work in Openshift/docker ssh termninal due to it has limited permissions unlike in other linux/unix servers. I used colon to separate the two commands.

java -classpath /var/lib/jenkins/bin:/var/lib/Jenkins/CYOV3/lib/* org.testng.TestNG testng.xml

Thanks a lot for everyone who suggested fixes and all advices

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.