"Run Command Line" fails, unable to find command from PATH environment variable

book

Article ID: 225476

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio)

Issue/Introduction

The agent is running under a functional account, after restart of an agent it fail to execute  jar/java etc. command set in its PATH variable via Run Command Line action.

ERROR

Run Command Line action has finished successfully.
Return value: 127
Std out:
Std err: /bin/sh: jar: command not found
Command line executed: /bin/sh -c jar xf /tmp/apigee/891989/ra-test-kvmap-1.0.0-SNAPSHOT.jar

Before the restart it worked normally. The jar command executed by Linux OS with that account works normally.

Cause

The JVM variables are used in the spawned process which is responsible for running the specified command. To understand why path to the JDK is lost, please follow below steps

Troubleshooting Steps

1: Run the action "Run Command Line" to execute below command and check the output to see if PATH is correct

    • echo $PATH [Linux]
    • echo %PATH% [Windows]

2: Check the conf\wrapper.conf file of the agent for any misconfiguration

Cause

There is a misconfiguration in the conf\wrapper.conf file of agent causing the issue, as agent unable to parse PATH correctly
#Misconfigured entry

set.PATH=.%WRAPPER_FILE_SEPARATOR%bin%WRAPPER_PATH_SEPARATOR%/opt/pki/tls/pki-java-se-8u40-ri/bin%PATH%
 
 The error/misconfiguration in above PATH is that no %WRAPPER_PATH_SEPARATOR% after the hardcoded path /opt/pki/tls/pki-java-se-8u40-ri/bin which is required.

Environment

Release : 6.7

Component : CA RELEASE AUTOMATION CORE

Resolution

Recommendation (Either one of below)

  • Remove this hard coded part from the set.PATH variable in the wrapper.conf (if it is possible). Correct value with this change is as below
set.PATH=.%WRAPPER_FILE_SEPARATOR%bin%WRAPPER_PATH_SEPARATOR%%PATH%
  • Alternative approach is to add %WRAPPER_PATH_SEPARATOR% after the /opt/pki/tls/pki-java-se-8u40-ri/bin in the set.PATH (if hard coded path is needed). Correct value with this change is as below
set.PATH=.%WRAPPER_FILE_SEPARATOR%bin%WRAPPER_PATH_SEPARATOR%/opt/pki/tls/pki-java-se-8u40-ri/bin%WRAPPER_PATH_SEPARATOR%%PATH%

Additional Information

Related KB's