Re: PL/Java 1.5.1_BETA2 - Mailing list pgsql-pkg-debian

From Christoph Berg
Subject Re: PL/Java 1.5.1_BETA2
Date
Msg-id 20180916201808.GA30681@msg.df7cb.de
Whole thread Raw
In response to Re: PL/Java 1.5.1_BETA2  (Chapman Flack <chap@anastigmatix.net>)
Responses Re: PL/Java 1.5.1_BETA2  (Christoph Berg <myon@debian.org>)
Re: PL/Java 1.5.1_BETA2  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-pkg-debian
Re: Chapman Flack 2018-09-15 <5B9D73A2.2090402@anastigmatix.net>
> On 09/15/18 16:32, Christoph Berg wrote:
> > Fatal Error: Unable to find package java.lang in classpath or bootclasspath
> > ...
> > openjdk-10-jdk is installed. Any idea what is missing?
> 
> With Java 9, a completely new modular structure was brought to the JDK,
> with deep implications for build procedures. I will have to rework the
> build process heavily for a future PL/Java release, but for 1.5.1, I
> have not.
> 
> So, it needs a Java 8 JDK (or 7, or 6, but let's just say 8) to build.

Ok, openjdk-8 worked, thanks. I was actually skimming the docs for the
supported Java versions, but couldn't find anything, so went with the
default-jdk in Debian, which is 10. A note in the docs would be
appreciated, or if it's already in there, it needs to be more visible.

> Once built, it will _run_ on later Java runtimes (and users can write
> PL/Java functions using the latest language features, compile them with
> later JDKs, and run them in PL/Java, as long as it is running on a new-
> enough runtime).
> 
> The Java runtime that actually gets used, at runtime, is determined by
> the pljava.libjvm_location variable, which can be given a default at
> build time with -Dpljava.libjvmdefault=....

I got that working just fine on sid/amd64, but have a series of
problems on i386 (i.e. 32-bit x86). The build is running with
-Dpljava.libjvmdefault=/usr/lib/jvm/java-8-openjdk-i386/jre/lib/i386/server/libjvm.so,
but then actually using the extension yields this:

https://pgdgbuild.dus.dg-i.net/job/postgresql-pljava-binaries/3/architecture=i386,distribution=sid/

20:14:15 + psql -c 'CREATE EXTENSION pljava'
20:14:15 WARNING:  Java virtual machine not yet loaded
20:14:15 DETAIL:  /usr/lib/jvm/java-8-openjdk-1/jre/lib/1/server/libjvm.so: cannot open shared object file: No such
fileor directory
 
20:14:15 HINT:  SET pljava.libjvm_location TO the correct path to the jvm library (libjvm.so or jvm.dll, etc.)

i.e. it's replacing both occurrences of "i386" by "1".

If I manually fix that, there's more weirdness:
(same session was running "create extension pljava" earlier)
# set pljava.libjvm_location = '/usr/lib/jvm/java-8-openjdk-i386/jre/lib/i386/server/libjvm.so';
HINWEIS:  00000: PL/Java loaded
DETAIL:  versions:
PL/Java native code (1.5.1-BETA2)
PL/Java common code (1.5.1-BETA2)
Built for (PostgreSQL 10.5 (Debian 10.5-2~30.git84cd21f.pgdg+1) on i686-pc-linux-gnu, compiled by gcc (Debian 8.2.0-4)
8.2.0,32-bit)
 
Loaded in (PostgreSQL 10.5 (Debian 10.5-2~30.git84cd21f.pgdg+1) on i686-pc-linux-gnu, compiled by gcc (Debian 8.2.0-4)
8.2.0,32-bit)
 
OpenJDK Runtime Environment (1.8.0_181-8u181-b13-1-b13)
OpenJDK Server VM (25.181-b13, mixed mode)
ORT:  initsequencer, Backend.c:597
HINWEIS:  00000: PL/Java successfully started after adjusting settings
TIP:  The settings that worked should be saved (using ALTER DATABASE postgres SET ... FROM CURRENT or in the
"/home/cbe/tmp/pg_virtualenv.m9FB0r/postgresql/10/regress/postgresql.conf"file). For a reminder of what has been set,
try:SELECT name, setting FROM pg_settings WHERE name LIKE 'pljava.%' AND source = 'session'
 
ORT:  initsequencer, Backend.c:639
HINWEIS:  00000: PL/Java load successful after failed CREATE EXTENSION
DETAIL:  PL/Java is now installed, but not as an extension.
TIP:  To correct that, either COMMIT or ROLLBACK, make sure the working settings are saved, exit this session, and in a
newsession, either: 1. if committed, run "CREATE EXTENSION pljava FROM unpackaged", or 2. if rolled back, simply
"CREATEEXTENSION pljava" again.
 
ORT:  initsequencer, Backend.c:654
SET

Why does tell me that this installation is not from an extension?

Proceeding to load the examples:

# SELECT sqlj.install_jar('file:/usr/share/postgresql/10/pljava/pljava-examples-1.5.1-BETA2.jar', 'examples', true)
;
HINWEIS:  42809: Rückgabetyp javatest.udtscalariotest ist nur eine Hülle
ORT:  compute_return_type, functioncmds.c:105
[...]
ORT:  Java_org_postgresql_pljava_internal_Backend__1log, Backend.c:1621
INFO:  00000: 16 Sep 18 19:54:06 org.postgresql.pljava.example.LoggerTest timestamptz roundtrip passes
ORT:  Java_org_postgresql_pljava_internal_Backend__1log, Backend.c:1621
INFO:  00000: 16 Sep 18 19:54:09 org.postgresql.pljava.example.LoggerTest all Unicode codepoint ranges roundtripped
successfully.
ORT:  Java_org_postgresql_pljava_internal_Backend__1log, Backend.c:1621
Server beendete die Verbindung unerwartet
    Das heißt wahrscheinlich, dass der Server abnormal beendete
    bevor oder während die Anweisung bearbeitet wurde.
Die Verbindung zum Server wurde verloren.  Versuche Reset: Fehlgeschlagen.

... it crashes.

> There is a new(-ish?) page in the documentation with information intended
> for packagers:
> 
> http://tada.github.io/pljava/build/package.html

Aye, I remember having seen that 2.5 years ago when I last tried
looking at 1.5.


Another question: Docs say
  mvn -Dpgsql.pgconfig=...
  java -Dpgconfig=/local/pgsql/bin/pg_config -jar pljava-packaging/...
I had first tried mvn -Dpgconfig, which didn't work - is it really two
different variable names?

And is -Dpgconfig even used if for the installer, when
-Dpgconfig.pkglibdir and -Dpgconfig.sharedir are given? I need to
point these to debian/postgresql-$version-pljava/usr/... A "DESTDIR"
mechanism would be nice to have here.


On stretch/amd64, install_jar fails on 9.6 (9.3/4/5 worked):

20:07:05 + psql -c 'CREATE EXTENSION pljava'
20:07:05 CREATE EXTENSION
20:07:05 + psql -c 'SELECT
sqlj.install_jar('\''file:/usr/share/postgresql/9.6/pljava/pljava-examples-1.5.1-BETA2.jar'\'','\''examples'\'',
true)'
[...]
20:07:07 INFO:  16 Sep 18 18:07:07 org.postgresql.pljava.management.Commands Type id = OID(16686)
20:07:07 ERROR:  java.lang.ClassNotFoundException: org.postgresql.pljava.example.annotation.ComplexTuple
20:07:07 CONTEXT:  SQL statement "SELECT javatest.assertHasValues( CAST('(1,2)' AS javatest.complextuple), 1, 2)"

https://pgdgbuild.dus.dg-i.net/job/postgresql-pljava-binaries/3/architecture=amd64,distribution=stretch/


On sid/ppc64el, compilation dies:

https://pgdgbuild.dus.dg-i.net/job/postgresql-pljava-binaries/3/architecture=ppc64el,distribution=sid/console

20:00:43 [ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.2.3:nar-validate (default-nar-validate)
onproject pljava-so: NAR: One of two things may be wrong here:
 
20:00:43 [ERROR] 1. <Name> tag is missing inside the <Linker> tag of your NAR configuration
20:00:43 [ERROR] 2. no linker is defined in the aol.properties file for 'ppc64le.Linux.linker'

Is that a problem in pljava, or a general java-on-that-platform
problem?


(I can open GitHub issues for any of these items if you confirm which
make sense.)

Christoph


pgsql-pkg-debian by date:

Previous
From: Chapman Flack
Date:
Subject: Re: PL/Java 1.5.1_BETA2
Next
From: Christoph Berg
Date:
Subject: Re: PL/Java 1.5.1_BETA2