Greenplum Error: "libjvm.so: cannot open shared object file: No such file or directory" when installing pl/java language extension
search cancel

Greenplum Error: "libjvm.so: cannot open shared object file: No such file or directory" when installing pl/java language extension

book

Article ID: 295511

calendar_today

Updated On:

Products

VMware Tanzu Greenplum Greenplum Pivotal Data Suite Non Production Edition VMware Tanzu Data Suite VMware Tanzu Data Suite

Issue/Introduction

Symptoms:

When we attempt to enable PL/java for a database, it returns the following error:

psql -d adw -f $GPHOME/share/postgresql/pljava/install.sql
psql:/opt/greenplum/greenplum-db/./share/postgresql/pljava/install.sql:1: ERROR: could not load library "/opt/greenplum/greenplum-db-4.3.6.2/lib/postgresql/pljava.so": libjvm.so: cannot open shared object file: No such file or directory
psql:/opt/greenplum/greenplum-db/./share/postgresql/pljava/install.sql:2: ERROR: could not load library "/opt/greenplum/greenplum-db-4.3.6.2/lib/postgresql/pljava.so": libjvm.so: cannot open shared object file: No such file or directory

 

Environment


Cause

This issue is due to an incorrect environment variable setting that results in a failure to find the library libjvm.so.


 

Resolution

Refer to: PL/Java Language documentation for information on how to install and configure the package.

If the issue remains, check where libjvm.so actually resides:

[root@mdw Downloads]# find / -name libjvm.so
/opt/greenplum/greenplum-db-4.3.6.2/ext/jre-1.6.0_32/lib/amd64/server/libjvm.so


Then, check the file $GPHOME/greeplum_path.sh:

JAVA_HOME=$GPHOME/ext/jre-1.6.0_32/jre1.6.0_32
export JAVA_HOME
path=$JAVA_HOME/bin:$PATH
export PATH
LD_LIBRARY_PATH=$JAVA_HOME/lib/amd64/server:$LD_LIBRARY_PATH


We can find the variable JAVA_HOME pointing to a directory that does not contain the file libjvm.so. So we can correct the value JAVA_HOME to "$GPHOME/ext/jre-1.6.0_32". Make sure to apply this change to the master and all segments. 
 

Now, restart the cluster and source $GPHOME/greenplum_path.sh.
 

Note: Make sure that the JAVA_HOME value is correct for the master and segments. If one of the segments has an incorrect value, the installation will fail with the same error.