We want to execute CLI command via CARA using the "Run Command Line" action, but are getting an error.
java -cp <jar paths> <initial.Class> -parameters values
Error By CARA :
(#1) Run Command Line action has finished successfully.
Return value: 127
Std err: /bin/sh: java: command not found
Release : 6.7
Component : CA Nolio Release Automation Agent
The action is being executed using the impersonation. The impersonation feature is using the sudo method. The recommended method for using to impersonate users is: sudo -u $3 -S ./ActionsRunner.sh ...
However, using this method makes it so that the users ~/.bashrc isn't executed - so its environment is very generic. In this case, it cannot find java.
There are at least two ways to solve this problem. Pick one of the following:
Modify the command to include the directory where java can be found. For example:
Instead of using the command: java -cp <jar paths> <initial.Class> -parameters values
Use: /path/to/java -cp <jar paths> <initial.Class> -parameters values
The second method involves updating two input fields of the "Run Command Line" action.