public inbox for [email protected]  
help / color / mirror / Atom feed
[Pljava-dev] problem implementing with ResultSetProvider
4+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] problem implementing with ResultSetProvider
@ 2010-08-04 02:05 
  2010-08-04 06:59 ` [Pljava-dev] problem implementing with ResultSetProvider 
  0 siblings, 1 reply; 4+ messages in thread

From:  @ 2010-08-04 02:05 UTC (permalink / raw)

Hi, All.

When I create and try to run a function implementing
ResultSetProvider, I get a "Unable to find static method with
signature..." error.

Java code:
import edu.sc.seis.TauP.Arrival;
import edu.sc.seis.TauP.TauModelException;
import edu.sc.seis.TauP.TauP_Time;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.postgresql.pljava.ResultSetProvider;

public class emTauP implements ResultSetProvider {

     private ResultSet rs;
     private static TauP_Time tt;
     private static Arrival[] arr;

     public emTauP(String model, String phaselist, double depth,
double gcarc) throws SQLException {

          // instantiate TauP_Time object, passing it the model name
          tt = new TauP_Time(model);

          // add the list of phases
          tt.parsePhaseList(phaselist);

          // correct for the source depth
          tt.depthCorrect(depth);

          // calculate for the distance in degrees
          tt.calculate(gcarc);

          // get the array of Arrival objects
          arr = tt.getArrivals();
     }

     public static ResultSetProvider TTimes(String model, String
phaselist, double depth, double gcarc) throws SQLException {
          // instantiate a new TauP class object
          return new emTauP(model, phaselist, depth, gcarc);
     }

     public boolean assignRowValues(ResultSet trs, int RowNum) throws
SQLException {
          if (rs.next()) {
          trs.updateString(1, arr[RowNum].getName());
          trs.updateDouble(2, arr[RowNum].getTime());
          trs.updateDouble(3, arr[RowNum].getRayParam());
          return(true);
          } else {
               return(false);
          }
     }

     public void close() throws SQLException {
          // does nothing, but required to implement ResultSetProvider
     }

}

I install the class in postgres (8.4), using: SELECT sqlj.install_jar(
'file:///EMERALD/Java/emTauP/emTauP.jar', 'emTauP', true )

I create the function:
CREATE OR REPLACE FUNCTION em_ttimes(em_model text, em_phaselist text,
em_depth double precision, em_gcarc double precision) RETURNS SETOF
public.em_ttime AS
	'emTauP.TTimes(java.lang.String, java.lang.String, double, double)'
	LANGUAGE java;

Then when I run it, I get the following error:
ERROR: Unable to find static method emTauP.TTimes with signature
(Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;

I can create and run functions which do not implement
ResultSetProvider, no problem.  Can anyone see something I'm doing
wrong, or is this a bug?

Thanks very much!
? ?? -- John




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* [Pljava-dev] problem implementing with ResultSetProvider
  2010-08-04 02:05 [Pljava-dev] problem implementing with ResultSetProvider 
@ 2010-08-04 06:59 ` 
  2010-08-04 16:32   ` [Pljava-dev] problem implementing with ResultSetProvider 
  0 siblings, 1 reply; 4+ messages in thread

From:  @ 2010-08-04 06:59 UTC (permalink / raw)

On Wednesday, August 04, 2010 04:05:05 am John D. West's cat walking on the 
keyboard wrote:
 
> Then when I run it, I get the following error:
> ERROR: Unable to find static method emTauP.TTimes with signature
> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetPro
> vider;
> 
> I can create and run functions which do not implement
> ResultSetProvider, no problem.  Can anyone see something I'm doing
> wrong, or is this a bug?
> 

I have recreated it on my system and I can invoke the function. It should not 
be a classpath problem, since that will lead to a class not found exception. 
Could you post the log to see if there is an hint?

Luca




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* [Pljava-dev] problem implementing with ResultSetProvider
  2010-08-04 02:05 [Pljava-dev] problem implementing with ResultSetProvider 
  2010-08-04 06:59 ` [Pljava-dev] problem implementing with ResultSetProvider 
@ 2010-08-04 16:32   ` 
  2010-08-04 20:20     ` [Pljava-dev] problem implementing with ResultSetProvider 
  0 siblings, 1 reply; 4+ messages in thread

From:  @ 2010-08-04 16:32 UTC (permalink / raw)

I set the logging levels to Debug5, and this is what I got when trying
to run the function:
2010-08-04 09:22:04 PDT DEBUG:  00000: 04 Aug 10 09:22:04
org.postgresql.pljava.internal.Backend Using SecurityManager for
trusted language
2010-08-04 09:22:04 PDT LOCATION:
Java_org_postgresql_pljava_internal_Backend__1log,
/usr/share/pljava/src/C/pljava/Backend.c:890
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT DEBUG:  00000: className = 'emTauP',
methodName = 'TTimes', parameters =
'java.lang.String,java.lang.String,double,double', returnType = 'null'
2010-08-04 09:22:04 PDT LOCATION:  parseFunction,
/usr/share/pljava/src/C/pljava/Function.c:400
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT DEBUG:  00000: 04 Aug 10 09:22:04
org.postgresql.pljava.sqlj.Loader Creating typeMappings for schema
public
2010-08-04 09:22:04 PDT LOCATION:
Java_org_postgresql_pljava_internal_Backend__1log,
/usr/share/pljava/src/C/pljava/Backend.c:890
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT DEBUG:  00000: Loading class emTauP
2010-08-04 09:22:04 PDT LOCATION:  Function_init,
/usr/share/pljava/src/C/pljava/Function.c:539
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT DEBUG:  00000: Obtaining method emTauP.TTimes
(Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
2010-08-04 09:22:04 PDT LOCATION:  Function_init,
/usr/share/pljava/src/C/pljava/Function.c:569
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT DEBUG:  00000: Method emTauP.TTimes
(Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
not found
2010-08-04 09:22:04 PDT LOCATION:  Function_init,
/usr/share/pljava/src/C/pljava/Function.c:578
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT DEBUG:  00000: Obtaining method emTauP.TTimes
(Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetHandle;
2010-08-04 09:22:04 PDT LOCATION:  Function_init,
/usr/share/pljava/src/C/pljava/Function.c:608
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);
2010-08-04 09:22:04 PDT ERROR:  XX000: Unable to find static method
emTauP.TTimes with signature
(Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
2010-08-04 09:22:04 PDT LOCATION:  PgObject_throwMemberError,
/usr/share/pljava/src/C/pljava/PgObject.c:101
2010-08-04 09:22:04 PDT STATEMENT:  select * from em_ttimes('PREM',
'SKS', 50, 99);

Does that cast light on anything?

Thanks!

     -- John

On Wed, Aug 4, 2010 at 12:59 AM, Luca Ferrari <fluca1978 at infinito.it> wrote:
> On Wednesday, August 04, 2010 04:05:05 am John D. West's cat walking on the
> keyboard wrote:
>
>> Then when I run it, I get the following error:
>> ERROR: Unable to find static method emTauP.TTimes with signature
>> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetPro
>> vider;
>>
>> I can create and run functions which do not implement
>> ResultSetProvider, no problem. ?Can anyone see something I'm doing
>> wrong, or is this a bug?
>>
>
> I have recreated it on my system and I can invoke the function. It should not
> be a classpath problem, since that will lead to a class not found exception.
> Could you post the log to see if there is an hint?
>
> Luca
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pljava-dev
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* [Pljava-dev] problem implementing with ResultSetProvider
  2010-08-04 02:05 [Pljava-dev] problem implementing with ResultSetProvider 
  2010-08-04 06:59 ` [Pljava-dev] problem implementing with ResultSetProvider 
  2010-08-04 16:32   ` [Pljava-dev] problem implementing with ResultSetProvider 
@ 2010-08-04 20:20     ` 
  0 siblings, 0 replies; 4+ messages in thread

From:  @ 2010-08-04 20:20 UTC (permalink / raw)

This seems to have been caused by my not installing into the database
(using sqlj.install_jar()) the external jar files this function
depends on.  It mostly works now.

thanks!

? ?? -- John



On Wed, Aug 4, 2010 at 9:32 AM, John D. West <JDW at fodoze.com> wrote:
> I set the logging levels to Debug5, and this is what I got when trying
> to run the function:
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: 04 Aug 10 09:22:04
> org.postgresql.pljava.internal.Backend Using SecurityManager for
> trusted language
> 2010-08-04 09:22:04 PDT LOCATION:
> Java_org_postgresql_pljava_internal_Backend__1log,
> /usr/share/pljava/src/C/pljava/Backend.c:890
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: className = 'emTauP',
> methodName = 'TTimes', parameters =
> 'java.lang.String,java.lang.String,double,double', returnType = 'null'
> 2010-08-04 09:22:04 PDT LOCATION: ?parseFunction,
> /usr/share/pljava/src/C/pljava/Function.c:400
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: 04 Aug 10 09:22:04
> org.postgresql.pljava.sqlj.Loader Creating typeMappings for schema
> public
> 2010-08-04 09:22:04 PDT LOCATION:
> Java_org_postgresql_pljava_internal_Backend__1log,
> /usr/share/pljava/src/C/pljava/Backend.c:890
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: Loading class emTauP
> 2010-08-04 09:22:04 PDT LOCATION: ?Function_init,
> /usr/share/pljava/src/C/pljava/Function.c:539
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: Obtaining method emTauP.TTimes
> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
> 2010-08-04 09:22:04 PDT LOCATION: ?Function_init,
> /usr/share/pljava/src/C/pljava/Function.c:569
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: Method emTauP.TTimes
> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
> not found
> 2010-08-04 09:22:04 PDT LOCATION: ?Function_init,
> /usr/share/pljava/src/C/pljava/Function.c:578
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT DEBUG: ?00000: Obtaining method emTauP.TTimes
> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetHandle;
> 2010-08-04 09:22:04 PDT LOCATION: ?Function_init,
> /usr/share/pljava/src/C/pljava/Function.c:608
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
> 2010-08-04 09:22:04 PDT ERROR: ?XX000: Unable to find static method
> emTauP.TTimes with signature
> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
> 2010-08-04 09:22:04 PDT LOCATION: ?PgObject_throwMemberError,
> /usr/share/pljava/src/C/pljava/PgObject.c:101
> 2010-08-04 09:22:04 PDT STATEMENT: ?select * from em_ttimes('PREM',
> 'SKS', 50, 99);
>
> Does that cast light on anything?
>
> Thanks!
>
> ? ? -- John
>
> On Wed, Aug 4, 2010 at 12:59 AM, Luca Ferrari <fluca1978 at infinito.it> wrote:
>> On Wednesday, August 04, 2010 04:05:05 am John D. West's cat walking on the
>> keyboard wrote:
>>
>>> Then when I run it, I get the following error:
>>> ERROR: Unable to find static method emTauP.TTimes with signature
>>> (Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetPro
>>> vider;
>>>
>>> I can create and run functions which do not implement
>>> ResultSetProvider, no problem. ?Can anyone see something I'm doing
>>> wrong, or is this a bug?
>>>
>>
>> I have recreated it on my system and I can invoke the function. It should not
>> be a classpath problem, since that will lead to a class not found exception.
>> Could you post the log to see if there is an hint?
>>
>> Luca
>> _______________________________________________
>> Pljava-dev mailing list
>> Pljava-dev at pgfoundry.org
>> http://pgfoundry.org/mailman/listinfo/pljava-dev
>>
>





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2010-08-04 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04 02:05 [Pljava-dev] problem implementing with ResultSetProvider 
2010-08-04 06:59 ` 
2010-08-04 16:32   ` 
2010-08-04 20:20     ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox