1

I'm trying to install PL/Java on PostgreSQL-9.5. My current server is Ubuntu 16.04. My reference link to install PL/Java is the official website: https://tada.github.io/pljava/install/install.html

The build process for PL/Java, as described in the link https://tada.github.io/pljava/build/build.html is working fine.

When I run mvn clean install the output is: maven output

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] PostgreSQL PL/Java ................................. SUCCESS [  1.049 s]
[INFO] PL/Java API ........................................ SUCCESS [  2.499 s]
[INFO] PL/Java backend Java code .......................... SUCCESS [  1.574 s]
[INFO] PL/Java backend native code ........................ SUCCESS [ 17.971 s]
[INFO] PL/Java Ant tasks .................................. SUCCESS [  0.179 s]
[INFO] PL/Java examples ................................... SUCCESS [  0.747 s]
[INFO] PL/Java packaging .................................. SUCCESS [  0.736 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.420 s
[INFO] Finished at: 2019-06-21T01:31:58-07:00
[INFO] Final Memory: 47M/576M
[INFO] ------------------------------------------------------------------------

When I run the self-extracting installer JAR, the output is: JAR Installer output

/usr/lib/postgresql/9.5/lib/libpljava-so-1.6.0-SNAPSHOT.so as bytes
/usr/share/postgresql/9.5/pljava/pljava-1.6.0-SNAPSHOT.jar as bytes
/usr/share/postgresql/9.5/pljava/pljava-api-1.6.0-SNAPSHOT.jar as bytes
/usr/share/postgresql/9.5/pljava/pljava-examples-1.6.0-SNAPSHOT.jar as bytes
/usr/share/postgresql/9.5/extension/pljava.control as lines (ASCII)
/usr/share/postgresql/9.5/pljava/pljava--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--unpackaged--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.2--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.1--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.1-BETA3--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.1-BETA2--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.1-BETA1--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.0--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.0-BETA3--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.0-BETA2--1.6.0-SNAPSHOT.sql as lines (UTF8)
/usr/share/postgresql/9.5/pljava/pljava--1.5.0-BETA1--1.6.0-SNAPSHOT.sql as lines (UTF8)

I have explictly set libjvm_location as well: libjvm_location set

postgres=# alter system set pljava.libjvm_location to '/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so';
ALTER SYSTEM
postgres=#

When I run CREATE EXTENSION pljava, i get the following error:

postgres=# CREATE EXTENSION pljava;
ERROR:  java.sql.SQLException: SPI function SPI_prepare failed with error SPI_ERROR_UNCONNECTED

1 Answers1

0

Another old question, answering just so future visitors will find something.

In this question, the version of PL/Java being built was an unreleased version (1.6.0-SNAPSHOT) and simply didn't include the changes at that time to support PostgreSQL 9.5.

Snapshot versions, and anything built from the master (development) branch, are moving targets, might be far from release, not work, set your house on fire, etc. Recommended practice is to check the releases page and select a recent official release.

If it will be used on Ubuntu or Debian, rather than building from source, it's usually simpler to add the PGDG apt repository and simply apt-get install postgresql-9.5-pljava (or your PostgreSQL version in place of 9.5).

Chapman Flack
  • 604
  • 5
  • 13