Diagnosing Java and JRE-related problems in UNIX environments


When you run SAS® in UNIX environments and attempt to use features that require Java (for example, ODS Graphics, SASIOMIE or INFOMAPS LIBNAME engines), you might encounter errors, such as the following:

To diagnose the problem, you must first ensure that the system environment variables required by SAS to locate and execute Java on the system are defined correctly. Use the SAS code available below to display the relevant variables.

The most common problem occurs when modifications are made to the dynamic link path in the sasenv_local file. Frequently, mistakes are made when paths are added to the relational database management system (RDBMS) client libraries, and instead of the RDBMS paths being correctly added to the existing value, the variable is completely (and incorrectly) redefined. For example, under Solaris, a correct value for the LD_LIBRARY_PATH environment variable when viewed from within SAS might appear like this:

/usr/local/SAS/jre1.5.0_12/lib/sparc/server:usr/local/SAS/jre1.5.0_12/
lib/sparc:usr/local/SAS/SASFoundation/9.2/sasexe:/usr/sfw/oracle/lib

In the above, the path to the Oracle client library is appended to the paths added for SAS in SASFoundation/9.2/bin/sasenv.

In order to correctly add the Oracle path, the following lines were added to the file SASFoundation/9.2/bin/sasenv_local:

ORACLE_HOME=/usr/sfw/oracle export ORACLE_HOME LD_LIBRARY_PATH=$LD_LIBRARY_PATH:
$ORACLE_HOME/lib export LD_LIBRARY_PATH

Notice the inclusion of $LD_LIBRARY_PATH in the definition. An incorrect specification would appear as follows:

ORACLE_HOME=/usr/sfw/oracle
export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH

Such a specification results in the value of LD_LIBRARY_PATH being completely redefined to contain only the Oracle path, resulting in errors when you attempt to access Java from within SAS.

The above discussion applies to all UNIX environments with respect to their linking paths:

Here are some other common problems:

The code below will print information on the value of the environment variables relevant to the operating system where SAS is executing. Not all of the variables will necessarily be defined, which is fine. For example, defining LD_LIBRARY_PATH_64 on Solaris can actually cause problems, which is why it must be checked; it is preferred that this variable is not defined. 

/*** BEGIN ***/
%macro getpaths ;
options set=TKJNI_OPT_TRACE="y" ;
%put TS Site: &SYSSITE ;
%put OS: &SYSSCP  &SYSSCPL ;
%put SAS Mode: &SYSPROCESSNAME ;
%put Host: &SYSTCPIPHOSTNAME ;
%put SAS Version: &sysvlong ;
%put User: &SYSUSERID ;
%put SASROOT: %sysget(SASROOT) ;
%put JAVA_HOME is: %sysget(JAVA_HOME) ;
%put CLASSPATH is: %sysget(CLASSPATH) ;
%put PATH is: %sysget(PATH) ;
%put DISPLAY is set as: %sysget(DISPLAY);

%if %index(&sysscp, SUN) or %index(&sysscp,LIN) %then %do ;
%put LD_LIBRARY_PATH is: %sysget(LD_LIBRARY_PATH) ;
%put LD_LIBRARY_PATH_64 is: %sysget(LD_LIBRARY_PATH_64) ;
%end ;

%else %if %index(&sysscp, AIX) %then %do ;
%put LIBPATH is: %sysget(LIBPATH) ;
%put IBM_JAVA_OPTIONS: %sysget(IBM_JAVA_OPTIONS) ;
%end ;

%else %if %index(&sysscp, HP) %then %do ;
%put SHLIB_PATH is: %sysget(SHLIB_PATH) ;
%end ;
%else %do;
%put SAS is not on a recognized Unix platform ;
%end ;

proc javainfo ;
run ;

proc options option=jreoptions ;
run ;

%mend ;

%getpaths ;
/**** END ****/