tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
238 stars 77 forks source link

Help demonstration example I can't use #421

Closed exqmjmz closed 3 months ago

exqmjmz commented 1 year ago

Demonstration example I can't use I tried different methods Prompt the following error example:ResultSetTest.java

CREATE OR REPLACE FUNCTION test_pljava(query TEXT) RETURNS TEXT AS 'com.kamin.pljava.Cases.executeSelect' LANGUAGE java
> ERROR:  java.sql.SQLNonTransientException: resolving static method com.kamin.pljava.Cases.executeSelect with signature (String)String: java.lang.NoSuchMethodException: no such method: com.kamin.pljava.Cases.executeSelect(String)String/invokeStatic
CREATE OR REPLACE FUNCTION test_pljava(query TEXT) RETURNS SETOF mv_case_template AS 'com.kamin.pljava.Cases.executeSelect' LANGUAGE java
> ERROR:  java.sql.SQLNonTransientException: resolving static method com.kamin.pljava.Cases.executeSelect with signature (String)ResultSetProvider: java.lang.NoSuchMethodException: no such method: com.kamin.pljava.Cases.executeSelect(String)ResultSetProvider/invokeStatic
jcflack commented 1 year ago

Hi,

Can you include the output of the following?

SELECT schemaname, jarname
  FROM sqlj.classpath_entry NATURAL JOIN sqlj.jar_repository
  ORDER BY schemaname, ordinal;

SHOW pljava.classpath;
SHOW search_path;

Very often, an issue like what you are reporting will have an explanation among those settings.

exqmjmz commented 1 year ago
SELECT schemaname, jarname
  FROM sqlj.classpath_entry NATURAL JOIN sqlj.jar_repository
  ORDER BY schemaname, ordinal;

SHOW pljava.classpath;
SHOW search_path;

SELECT schemaname, jarname FROM sqlj.classpath_entry NATURAL JOIN sqlj.jar_repository ORDER BY schemaname, ordinal; return:

schemaname jarname public pgjar

SHOW pljava.classpath; return:

ERROR: unrecognized configuration parameter "pljava.classpath"

SHOW search_path; return:

search_path public, "$user", public

jcflack commented 1 year ago

Oops, sorry, I copied the show pljava.classpath from an older issue, before the variable name changed. It would be show pljava.module_path in recent versions.

But even that might be less important here than

SELECT sqlj.get_classpath('public');
exqmjmz commented 1 year ago

Oops, sorry, I copied the show pljava.classpath from an older issue, before the variable name changed. It would be show pljava.module_path in recent versions.

But even that might be less important here than

SELECT sqlj.get_classpath('public');

It's all right, glad you helped! return:

get_classpath pgjar

jcflack commented 1 year ago

This may show more:

\c
SET client_min_messages TO debug1;
CREATE OR REPLACE FUNCTION test_pljava(query TEXT) RETURNS TEXT AS 'com.kamin.pljava.Cases.executeSelect' LANGUAGE java;

Sometimes during create-time validation, another exception further down the stacktrace may end up looking like the method wasn't found.

If you don't see more useful output at the client, also take a look in the server log afterward.

jcflack commented 1 year ago

Was there any resolution?

jcflack commented 3 months ago

Closed waiting on reporter