Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nQcFw-0000Kc-Bj for pljava-dev@arkaria.postgresql.org; Sat, 05 Mar 2022 21:48:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nQcFt-0007nj-Lz for pljava-dev@arkaria.postgresql.org; Sat, 05 Mar 2022 21:48:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nQcFt-0007na-4D for pljava-dev@lists.postgresql.org; Sat, 05 Mar 2022 21:48:01 +0000 Received: from anastigmatix.net ([68.171.219.55]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nQcFo-0004J3-SV for pljava-dev@lists.postgresql.org; Sat, 05 Mar 2022 21:47:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XV6ReVSgjXXnFPgIAzJBLa20svBg13iUUDQFxY7Qzf4=; b=ESG3BL2De+0sWh83kX6R8JAlq2 PMM3qozqdwhjMqtvFdDr4euRPps3C90dQdUJGiFcpExnrzBfdZmcHJe67CJFTPsWqxuh2fnNBtI9U H1+vYQTK1WEZXFOCEqntGIjmTXeJqRHV9TYnhkXVfnCwv1ZZEVq8JMishiQ+Bo5MQm1CZl6Y/gotR WQpcoycizdQ1RNxVgkW12bEPJ6X4ddaSP48yxjXm4EHRDBMCaeZxTj9qMBnzfriysxPQYClTtAkk0 7rxzJ0dvQ3XmrP1N+v10yJBfT1Mkw1vQEpgmDJ96zXCvKjwYEIGSiswSZVKRyqTuylpS9sHyGH2JV A5te4htg==; Received: from 50-102-16-206.prtg.in.frontiernet.net ([50.102.16.206]:51276) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nQcFm-00G37f-02; Sat, 05 Mar 2022 16:47:55 -0500 Subject: Re: Problem running examples.jar with official postgresql pljava deb To: Bear Giles , pljava-dev@lists.postgresql.org References: From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <6223DA89.80607@anastigmatix.net> Date: Sat, 5 Mar 2022 16:47:53 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 03/05/22 16:10, Bear Giles wrote: > INFO: 05 Mar 22 21:01:28 org.postgresql.pljava.example.LoggerTest > aggregate examples ok > INFO: 05 Mar 22 21:01:28 > org.postgresql.pljava.example.annotation.SPIActions issue 228 tests ok > ERROR: java.sql.SQLNonTransientException: resolving static method > org.postgresql.pljava.example.saxon.S9.like_regex with signature > (String,String,String,boolean)boolean: java.lang.ClassNotFoundException: > net.sf.saxon.trans.XPathException I think you are running into the known complication that was introduced with 1.6.0, where functions are now validated at CREATE FUNCTION time, and can fail if a dependency isn't resolvable at that time. That's described here: http://tada.github.io/pljava/examples/examples.html#Exception_resolving_class_or_method_.28message_when_installing_examples.29 with two different ways you can proceed: Install the required dependency first. Use sqlj.install_jar to install the Saxon jar (as described here), and sqlj.set_classpath to make it accessible, and then use sqlj.install_jar to install the examples jar itself. The dependency will be satisfied and all of the example functions will work. Use SET check_function_bodies TO off before installing the examples jar. That will simply relax the strict checking at CREATE FUNCTION time, so that all of the example functions will be created. The ones that require Saxon, of course, won’t work; SET check_function_bodies TO off simply means you get the errors later, when trying to use the functions, instead of when creating them. If you install the dependency jar later and add it to the class path, those functions will then work. The Saxon jar is pure library code; it doesn't declare any PL/Java functions. So no particular schema needs to exist before installing it. Of course, it needs to be added to a classpath before installing the examples jar (if using the dependency-first approach). I generally just add it to the public schema, which is the fallback for other schema class paths. SELECT sqlj.set_classpath('public', 'saxon'); Or, you might find it more convenient to use the SET check_function_bodies TO off; approach, install the examples jar first, then install the saxon jar, and finish by setting the schema classpath for javatest (which will exist by that point) to 'examples:saxon'. Regards, -Chap