We have created Batch file which runs a Javelin/Selenium script and created action in Data maker under one of the publish jobs.
We are able to execute the action in Data maker, As well as directly from Javelin, without issue. Whereas, we are unable to execute same action in CA TDM Portal Self Service Catalog.
When the script is executed, a Chrome window should popup and execute selenium script. However, when run from Portal, we see the status set to Complete, but Chrome does not pop up, and the Selenium script fails to execute. The , whereas, doesn't pop up anything on CA TDM Portal. But status on portal is being set to "Complete" with even starting.
The TDMPublish.log shows the following error:
Warning action EXCEUTE_JAVELIN failed: exitVal: 0 error output: The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
Looking at the Environmental Variables, we see JAVA_HOME=C:\Program Files\Java\jdk1.8.0_231\
Why can't the Portal execute the script?
Portal runs as a service; CA Test Data Manager Portal service.
The account running the service does not have access to JAVA_HOME variable, or more specifically, the OS is not resolving the JAVA_HOME environmental variable for the Portal service.
Adding the "set > c:\temp\set.log" command to the top of the batch file helped show what environmental variables are returned by the OS.
In this case, when running the batch file from Portal we see the service is trying to use JAVA_HOME=../../jre and not the System Environmental Variable path defined by JAVA_HOME=C:\Program Files\Java\jdk1.8.0_231\.
Release : 4.6
Component : CA Test Data Manager
As for this issue, there is nothing we can do from an application standpoint. The CA Test Data Manager Portal service doesn't care or change Environmental variables. If we did, and logged our own Environmental variables as part of the application configuration, we would mess up the OS security. We relay on the OS resolving the variables for us. We also don't care if you run the JRE or the JDK.
Engineering explained the reason we are seeing JAVA_HOME=..\..\jre is because the TDM Portal application itself is a java application, which requires the application to have its own JRE to run. Since we cannot execute the System's JAVA_HOME we reset to the internal jre (../../jre) which fails because we need access to the System's JAVA_HOME, which is not getting resolved by the OS. So you shouldn't focus on the ../../jre path, but rather focus on why the system is not returning JAVA_HOME to the Portal Service.
Since this is an OS issue, we cannot advise you on how to troubleshoot the OS. Also, reinstalling the Portal Service, or the TDM Portal application will not have any impact, because we still rely on the OS to resolve JAVA_HOME when needed. Since the system is not providing the Portal JAVA_HOME, the only solution is to override the System variable by defining it in the script.