Closed shenjianrong closed 4 months ago
SELECT sqlj.install_jar( 'file:///home/sjr/tmp/esproc-bin.jar', 'esproc_bin', true ); SELECT sqlj.install_jar( 'file:///home/sjr/tmp/spludf.jar', 'spludf', true ); SELECT sqlj.set_classpath( 'public', 'esproc_bin:spludf' );
That is the way that's intended to work.
ERROR: java.lang.NoClassDefFoundError: Could not initialize class com.scudata.common.Logger
This exception suggests that PL/Java has successfully loaded the class com.scudata.common.Logger
and begun to initialize it, but from that class's initialization code some other class was referred to and could not be found.
If you SET log_min_messages TO debug1
(in a new session, before any PL/Java code has been called) so that Java will write stacktraces to the server log, then by looking in the server log you should be able to determine what is missing.
Thanks for your correct reply! My question has been solved.
The postgresql version is 16.3 The PL/Java version is 1.6.7 My UDF needs load 2 jars: esproc-bin.jar and spludf.jar I have run following commands: SELECT sqlj.install_jar( 'file:///home/sjr/tmp/esproc-bin.jar', 'esproc_bin', true ); SELECT sqlj.install_jar( 'file:///home/sjr/tmp/spludf.jar', 'spludf', true ); SELECT sqlj.set_classpath( 'public', 'esproc_bin:spludf' ); The error throws when I run this SQL query: Select myUdf(......); ERROR: java.lang.NoClassDefFoundError: Could not initialize class com.scudata.common.Logger The Logger class is included in esproc-bin.jar. If I run folowing commands: SELECT sqlj.set_classpath( 'public', 'spludf' ); SELECT sqlj.set_classpath( 'public', 'esproc_bin' ); Select myUdf(......); The error changes: ERROR: java.lang.ClassNotFoundException: com.scudata.postgresql.pljava.SPLUdf The SPLUdf class is included in spludf,jar. How should I set the correct classpath?