You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
java.sql.SQLNonTransientException: Resolving class org.postgresql.pljava.example.saxon.S9: java.lang.NoClassDefFoundError: net/sf/saxon/trans/XPathException #336
You mention that users should read the release announcement when upgrading, but I had problems finding that on https://github.com/tada/pljava/wiki. Perhaps that should be linked more prominently.
If the build is done with -Psaxon-examples, then an optional set of examples will be built and included in the jar, which require another jar Saxon-HE, which will in that case have been downloaded by Maven and can be found in the local Maven repository as ~/.m2/repository/net/sf/saxon/Saxon-HE/$saxonver/Saxon-HE-$saxonver.jar.
Now that dependencies are checked by default at function creation time, installing the examples jar without installing the Saxon jar first will normally fail the dependency check.
There are two ways around that. One is to find the Saxon-HE jar that was downloaded into the Maven repo and install that, add it to the classpath, and then install the examples jar, so the dependency checks are satisfied.
The other is to SET check_function_bodies TO off; before installing the examples jar, thus disabling the dependency checking. The examples jar will then install successfully, while any later attempts to use the Saxon-based functions will fail at runtime if the dependency jar isn't present. That's essentially how it worked pre-1.6.
I think it is worthwhile to build the examples with -Psaxon-examples, rather than distributing a version built without it, but that means the test script will need to use one of those two approaches to complete the test installation.
psql -c "ALTER USER $PGUSER SET pljava.module_path = '$PLJAR'"
The module system introduced in Java 9 associates modules with jars, so starting with 1.6 there is a jar for the API and one for the implementation and both have to be on the module_path, so it should look like
psql -c "ALTER USER $PGUSER SET pljava.module_path = '$PLJAR:$PLAPIJAR'"
where $PLAPIJAR is found the same way as $PLJAR, but matching the glob pljava-api-*.jar.
Other than that (and testing the examples jar install either with check_function_bodies set to off or with the Saxon-HE jar installed first), I don't see any obvious problems.
Activity
jcflack commentedon Nov 27, 2020
https://tada.github.io/pljava/releasenotes.html#Validation_at_CREATE_FUNCTION_time_may_force_changes_to_deployment_procedures
TL;DR install the dependent Saxon jar first; the order didn't matter in 1.5 because dependencies weren't checked at CREATE FUNCTION time.
For the adventuresome, the self-installer jar now includes some test-harnessy features not unlike PostgreSQL's PostgresNode.pm:
https://tada.github.io/pljava/develop/node.html
jcflack commentedon Nov 27, 2020
I'm about to begin the formalities of a 1.6.2 release.
Please don't publish a 1.6.1 package ever. With the #331 bug, it'll just break people's stuff.
df7cb commentedon Nov 27, 2020
Aye.
jcflack commentedon Nov 28, 2020
Better now?
df7cb commentedon Dec 2, 2020
Sorry, what does "install the dependent Saxon jar first" mean? There is no "saxon.jar" file installed by the package, nor on the system.
df7cb commentedon Dec 2, 2020
For more context, I'm trying to get https://salsa.debian.org/postgresql/postgresql-pljava/-/blob/master/debian/tests/test.sh running.
The file is used both from installed-time tests (DESTDIR unset), and at buildtime (when DESTDIR is pointing to $PWD/debian/postgresql-NN-pljava).
jcflack commentedon Dec 2, 2020
If the build is done with
-Psaxon-examples, then an optional set of examples will be built and included in the jar, which require another jar Saxon-HE, which will in that case have been downloaded by Maven and can be found in the local Maven repository as~/.m2/repository/net/sf/saxon/Saxon-HE/$saxonver/Saxon-HE-$saxonver.jar.Now that dependencies are checked by default at function creation time, installing the examples jar without installing the Saxon jar first will normally fail the dependency check.
There are two ways around that. One is to find the Saxon-HE jar that was downloaded into the Maven repo and install that, add it to the classpath, and then install the examples jar, so the dependency checks are satisfied.
The other is to
SET check_function_bodies TO off;before installing the examples jar, thus disabling the dependency checking. The examples jar will then install successfully, while any later attempts to use the Saxon-based functions will fail at runtime if the dependency jar isn't present. That's essentially how it worked pre-1.6.I think it is worthwhile to build the examples with
-Psaxon-examples, rather than distributing a version built without it, but that means the test script will need to use one of those two approaches to complete the test installation.jcflack commentedon Dec 18, 2020
Is there more I can help with? I notice there doesn't seem to be a package available for 1.5.7 or for 1.6.2.
I did notice one thing that may need a change in https://salsa.debian.org/postgresql/postgresql-pljava/-/blob/master/debian/tests/test.sh :
The module system introduced in Java 9 associates modules with jars, so starting with 1.6 there is a jar for the API and one for the implementation and both have to be on the
module_path, so it should look likewhere
$PLAPIJARis found the same way as$PLJAR, but matching the globpljava-api-*.jar.Other than that (and testing the examples jar install either with
check_function_bodiesset tooffor with the Saxon-HE jar installed first), I don't see any obvious problems.df7cb commentedon Feb 3, 2021
I got the tests working now: https://salsa.debian.org/postgresql/postgresql-pljava/-/blob/master/debian/tests/test.sh
Thanks for the help!