db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..
Date Fri, 27 Mar 2009 13:59:55 GMT
Thanks for finding this bug, Krzysztof. Derby is using the wrong 
classloader to look up optimizer overrides for table functions and this 
raises the ClassNotFoundException which you are seeing. I have logged 
the following issue to track the problem: 
http://issues.apache.org/jira/browse/DERBY-4126

Thanks,
-Rick

Krzysztof N wrote:
> Futhermore, I'm able to stop on breakpoint while debugging this table
> function and  select'ing does not even have a chance to call it, obviously.
> Best Regards
>
>
>
> Krzysztof N wrote:
>   
>> Hello,
>> I'm trying to get basic table function running without much success.
>> Either error is misleading or I missed some basic point, could you
>> please advise?
>>
>> public class DerbyBlobTableFunction {
>>
>>  //this works
>>   public static int returnSth()
>>     {
>>         return 1;
>>     }
>>
>> //does not work, see error below
>>  public static ResultSet getTSValuesEmpty()  throws SQLException
>>     {
>>          List<double[]> results = new ArrayList<double[]>();
>>         results.add(new double[]{1.0,2.0,3.0});
>>          ResultSet rs = new ResultSetTemplate(results);
>> --//ResultSetTemplate implements ResultSet but same error with Derby
>> impl of ResultSet
>>         return rs;
>>     }
>>
>> }
>>
>>
>> then
>>
>>
>> CALL SQLJ.install_jar
>> ('/pathto/kn.jar', 'APP.kn', 0); -- OK
>>
>> CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY
>> ('derby.database.classpath', 'APP.kn'); --OK
>>
>>
>> CREATE FUNCTION MYFUNC() returns int PARAMETER STYLE JAVA reads
>> sql data language JAVA EXTERNAL NAME
>> ''gaia.cu7.dal.DerbyBlobTableFunction.returnSth'; --OK
>>
>> values MYFUNC() ; --OK
>> returns:
>>
>> 1
>>
>>
>> CREATE FUNCTION getTSValuesEmpty()
>> RETURNS TABLE	
>> (	
>>   obs      double,
>>   val      double,	
>>   valError double
>> )
>> LANGUAGE JAVA
>> PARAMETER STYLE DERBY_JDBC_RESULT_SET
>> reads SQL data --  switching to no sql does not change
>> EXTERNAL NAME ''gaia.cu7.dal.DerbyBlobTableFunction.getTSValuesEmpty'
>> --OK
>>
>> then:
>>
>> select * from table ( getTSValuesEmpty() ) t;
>>
>> gives:
>>
>> An error occurred when executing the SQL command:
>> select * from table ( getTSValuesEmpty() ) t
>> The exception 'java.lang.ClassNotFoundException:
>> gaia.cu7.dal.DerbyBlobTableFunction' was thrown while evaluating an
>> expression. [SQL State=38000, DB Errorcode=20000]
>> Next: Java exception: 'gaia.cu7.dal.DerbyBlobTableFunction:
>> java.lang.ClassNotFoundException'. [SQL State=XJ001]
>>
>> Execution time: 0.04s
>>
>> 1 statement(s) failed.
>>
>>
>> _but_
>>
>> values getTSValuesEmpty();
>>
>> gives:
>> 1
>> gaia.cu7.dal.ResultSetTemplate@10fa2e17
>>
>>
>> MacOS,  Derby 10.4.2.0, embedded mode.
>>
>>
>> Could you please enlighten me what could be wrong? Seems error message
>> is plain wrong as 'values' returns the reference to resultset, and
>> regular function from the same class works as well as values call..
>>
>> Best regards,
>> Krzysztof
>>
>>
>>     
>
>   


Mime
View raw message