Pivotal Knowledge Base

Follow

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

Environment 

Pivotal Greenplum: 4.3.x

Symptom

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

Cause

Refer to this link and restart the cluster, then the issue will most probably be resolved.
But sometimes this issue might possibly remain even after restarting the Database. It happens because of the incorrect environment variable setting that results in a failure to find the library libjvm.so.

Solution

Firstly, check where libjvm.so actually resides:

[root@dw-greenplum-1 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 on master and all segments. 

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

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

 

 

Comments

Powered by Zendesk