public inbox for [email protected]  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Function Error
Date: Wed, 24 Mar 2010 11:01:30 -0500
Message-ID: <8661B041D452404E8088FBD47D2443BE2532EF@NDCEXCUS703.int.asurion.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

I believe the problem is the classpath.  You are putting the jar in the
public schema but your function is in the sim schema.  Try this:

select sqlj.remove_jar('sim', true);
select * from
sqlj.install_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim_ja
r',true);
select sqlj.set_classpath('sim', 'sim_jar');

CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
                 RETURNS double precision
                 AS 'simpleMonteCarlo.sim.chi2cdf'
                 LANGUAGE java;

If that isn't it, try changing the Java method to return a
java.lang.String and then have your PostgreSQL function return a
character varying.  That will eliminate the possibility of a signature
problem.


Jon

-----Original Message-----
From: pljava-dev-bounces at pgfoundry.org
[mailto:pljava-dev-bounces at pgfoundry.org] On Behalf Of Susan M Farley
Sent: Wednesday, March 24, 2010 10:34 AM
To: pljava-dev at pgfoundry.org
Subject: [Pljava-dev] Function Error

I'm trying to import a function in Java, but am having problems with it.
The java function is

public static double chi2cdf (double x)
{
  return chi.cdf(x);
}

I copied the sim.class file to the Postgres data directory and I added
it to Postgres with the following
select
sqlj.replace_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim',t
rue);

SELECT sqlj.set_classpath('public', 'sim');

CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
                 RETURNS double precision
                 AS 'simpleMonteCarlo.sim.chi2cdf'
                 LANGUAGE java;

When I try to run it, I get the following error:
ERROR:  Unable to find static method simpleMonteCarlo.sim.chi2cdf with
signature (D)D

I thought it was the signature of double precision, but then tried it
with two other functions, one a float and one a int and get similar
errors. Does anyone have any ideas?

Thank you,
Susan



-- 
Sent via pgsql-novice mailing list (pgsql-novice at postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
_______________________________________________
Pljava-dev mailing list
Pljava-dev at pgfoundry.org
http://pgfoundry.org/mailman/listinfo/pljava-dev




view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Subject: Re: [Pljava-dev] Function Error
  In-Reply-To: <8661B041D452404E8088FBD47D2443BE2532EF@NDCEXCUS703.int.asurion.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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