How to troubleshoot Java issues in the Direct Marketing Agent


Java configuration problems can prevent the Direct Marketing Agent from starting or running correctly. These issues commonly occur after operating system patching, software upgrades, or changes to Java installations.

This SAS KB article outlines how to diagnose and resolve Java failures that occur when running the Direct Marketing Agent, such as the following:

Unable to start SAS_CI_360_OnpremAgent agent

ERROR: JAVA_HOME is set to an invalid directory

These errors typically indicate that the Java environment has changed, but the Direct Marketing Agent’s configuration still points to outdated Java paths.

Java issues usually stem from one of the following:

Recommended Troubleshooting Steps

Verify How the Agent Daemon Is Started:

The agent might be configured to run as a service, but you might be starting it manually. 

Confirm the correct startup method:  

If you start the agent with only run.sh, it stops when the user logs off. Always start the agent as a service.  

Check the JAVA_HOME Setting in the Service Configuration: 

Locate the direct-agent-service.env file:

cd /opt/sas/onprem/systemd
cat direct-agent-service.env

The following is an example entry:

JAVA_HOME=/opt/sas/SASHome/SASPrivateJavaRuntimeEnvironment/9.4/jre

Confirm that the Java path is still valid. Update the patch if Java was patched or relocated.

Tip: It is a good idea to use the SAS® 9.4 Private Java Runtime Environment because this it does not change.

Review System Logs for Java Errors:

Use the following command to gather system-level messages on Linux:

sudo cat /var/log/messages

Look for hints such as ERROR_TENANT_MISSING, which might indicate related configuration issues.   

Check User Profile Environment Variables:

On Linux, - Inspect .bashrc to confirm whether JAVA_HOME is set there:

cat ~/.bashrc

If Java was updated, the path might no longer be valid.

Validate Java Installation on the System:

Run the following commands to inspect Java and JVM directories:

Linux:

env
java -version
cd /usr/lib/jvm
ls -latr

Windows (at a command prompt type)

set

Find JAVA_HOME location. 

Here is an example: 

cd C:\Program Files\SASHome\SASPrivateJavaRuntimeEnvironment\9.4\jre\bin
java -version

These commands help verify whether Java is installed correctly and whether multiple versions exist.

Avoid Setting JAVA_HOME Inside run.sh:

Do not place JAVA_HOME inside run.sh. JAVA_HOME will be overwritten during upgrades. 

Compare Configuration Files After Upgrades:

Always compare your existing cionprem.properties file with the newly downloaded version after upgrades.  

In addition, make a backup before installing or upgrading the agent. 

See Upgrade the Direct Agent for additional information.

Summary

Java issues in the Direct Marketing Agent typically arise from mismatched or outdated Java paths, incorrect startup methods, or environment variable inconsistencies.

By validating the daemon startup method, checking JAVA_HOME, reviewing logs, and confirming system-level Java installation, you can resolve most Java agent failures quickly.

References