You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Krzysztof N <ya...@gmail.com> on 2009/03/25 12:16:19 UTC

Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

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
> 
> 

-- 
View this message in context: http://www.nabble.com/Uinable-to-use-Table-function-due-to-java.lang.ClassNotFoundException--while-class-is-clearly-reachable..-tp22478383p22699492.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Krzysztof,

It is interesting that you are getting ClassNotFoundException when 
executing the vti as a scalar function. Previously, that experiment 
succeeded for you. One thing I notice from your previous, successful 
resolution of the scalar function is that Derby loaded the class from 
your "VariFramework" jar. The following snippet comes from the piece of 
the Derby log which you posted on March 25:

    Loaded gaia.cu7.dal.DerbyBlobTableFunction from database jar 
"APP"."VariFramework"

But now your code is expecting to find the class in a different jar 
file, viz., "kn". Are you confident that the class is in the correct jar 
file and that the database classpath is correct? What happens when you 
invoke the MYFUNC scalar function which you have bound to 
gaia.cu7.dal.DerbyBlobTableFunction.returnSth?

Thanks,
-Rick



Krzysztof N wrote:
> Hello Rick,
> Thank you for fast response. Still have some issues though - I am using
> trunk version, repeated installation of jars - same way as before.
> Both scalar 'values' and table function call give ClassNotFoundException
> originating from ReflectClassesJava2:loadClassNotInDatabaseJar now:
>
> <log>
> ERROR 42X51: The class 'gaia.cu7.dal.DerbyBlobTableFunction' does not exist
> or is inaccessible. This can happen if the class is not public.
>         at
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:296)
>         at
> org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(QueryTreeNode.java:1445)
>         at
> org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:256)
>         at
> org.apache.derby.impl.sql.compile.FromVTI.bindVTITables(FromVTI.java:541)
>         at
> org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:322)
>         at
> org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:390)
>         at
> org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
>         at
> org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
>         at
> org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:245)
>         at
> org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:316)
>         at
> org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
>         at
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:802)
>         at
> org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
>         at
> org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(EmbedStatement.java:152)
> ...
> Caused by: java.lang.ClassNotFoundException:
> gaia.cu7.dal.DerbyBlobTableFunction
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:169)
>         at
> org.apache.derby.impl.services.reflect.ReflectClassesJava2.loadClassNotInDatabaseJar(ReflectClassesJava2.java:108)
>         at
> org.apache.derby.impl.services.reflect.DatabaseClasses.loadApplicationClass(DatabaseClasses.java:232)
>         at
> org.apache.derby.iapi.services.loader.ClassInspector.getClass(ClassInspector.java:832)
>         at
> org.apache.derby.iapi.services.loader.ClassInspector.accessible(ClassInspector.java:134)
>         at
> org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(QueryTreeNode.java:1437)
>         ... 17 more
> ============= begin nested exception, level (1) ===========
> java.lang.ClassNotFoundException: gaia.cu7.dal.DerbyBlobTableFunction
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:169)
>         at
> org.apache.derby.impl.services.reflect.ReflectClassesJava2.loadClassNotInDatabaseJar(ReflectClassesJava2.java:108)
>         at
> org.apache.derby.impl.services.reflect.DatabaseClasses.loadApplicationClass(DatabaseClasses.java:232)
>         at
> org.apache.derby.iapi.services.loader.ClassInspector.getClass(ClassInspector.java:832)
>         at
> org.apache.derby.iapi.services.loader.ClassInspector.accessible(ClassInspector.java:134)
>         at
> org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(QueryTreeNode.java:1437)
>         at
> org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:256)
>         at
> org.apache.derby.impl.sql.compile.FromVTI.bindVTITables(FromVTI.java:541)
>         at
> org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:322)
>         at
> org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:390)
>         at
> org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
>         at
> org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
>         at
> org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:245)
>         at
> org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:316)
>         at
> org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
>         at
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:802)
>         at
> org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
>         at
> org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(EmbedStatement.java:152)
> ...
> ============= end nested exception, level (1) ===========
> </log>
>
> Seems internal classpath is set properly:
>
> <log>
> Executing prepared statement: CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY
> ('derby.database.classpath', 'APP.kn') :End prepared statement
> Database Class Loader started - derby.database.classpath='APP.kn'
> 2009-03-31 11:03:39.148 GMT Thread[SQL Execution Thread 1,6,main] (XID =
> 194), (SESSIONID = 1), CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY
> ('derby.database.classpath', 'APP.kn') ******* null
> </log>
>
> Best regards,
> Krzysztof
>   


Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

Posted by Krzysztof N <ya...@gmail.com>.
Hello Rick,
Thanks for spotting this - I was creating small jar by hand and omitted
package path this time. 
It's working now! Big thanks for quick resolution.
Best regards,
Krzysztof


Krzysztof N wrote:
> 
> Forgot to add error codes from the driver:
> select * from table ( getTSValuesEmpty() ) t
> The class 'gaia.cu7.dal.DerbyBlobTableFunction' does not exist or is
> inaccessible. This can happen if the class is not public. [SQL
> State=42X51, DB Errorcode=20000] 
> Next: Java exception: 'gaia.cu7.dal.DerbyBlobTableFunction:
> java.lang.ClassNotFoundException'. [SQL State=XJ001] 
> 
> Cheers,
> Krzysztof
> 

-- 
View this message in context: http://www.nabble.com/Uinable-to-use-Table-function-due-to-java.lang.ClassNotFoundException--while-class-is-clearly-reachable..-tp22478383p22805223.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

Posted by Krzysztof N <ya...@gmail.com>.
Forgot to add error codes from the driver:
select * from table ( getTSValuesEmpty() ) t
The class 'gaia.cu7.dal.DerbyBlobTableFunction' does not exist or is
inaccessible. This can happen if the class is not public. [SQL State=42X51,
DB Errorcode=20000] 
Next: Java exception: 'gaia.cu7.dal.DerbyBlobTableFunction:
java.lang.ClassNotFoundException'. [SQL State=XJ001] 

Cheers,
Krzysztof
-- 
View this message in context: http://www.nabble.com/Uinable-to-use-Table-function-due-to-java.lang.ClassNotFoundException--while-class-is-clearly-reachable..-tp22478383p22802935.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

Posted by Krzysztof N <ya...@gmail.com>.

Hello Rick,
Thank you for fast response. Still have some issues though - I am using
trunk version, repeated installation of jars - same way as before.
Both scalar 'values' and table function call give ClassNotFoundException
originating from ReflectClassesJava2:loadClassNotInDatabaseJar now:

<log>
ERROR 42X51: The class 'gaia.cu7.dal.DerbyBlobTableFunction' does not exist
or is inaccessible. This can happen if the class is not public.
        at
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:296)
        at
org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(QueryTreeNode.java:1445)
        at
org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:256)
        at
org.apache.derby.impl.sql.compile.FromVTI.bindVTITables(FromVTI.java:541)
        at
org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:322)
        at
org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:390)
        at
org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
        at
org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
        at
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:245)
        at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:316)
        at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
        at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:802)
        at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        at
org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(EmbedStatement.java:152)
...
Caused by: java.lang.ClassNotFoundException:
gaia.cu7.dal.DerbyBlobTableFunction
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at
org.apache.derby.impl.services.reflect.ReflectClassesJava2.loadClassNotInDatabaseJar(ReflectClassesJava2.java:108)
        at
org.apache.derby.impl.services.reflect.DatabaseClasses.loadApplicationClass(DatabaseClasses.java:232)
        at
org.apache.derby.iapi.services.loader.ClassInspector.getClass(ClassInspector.java:832)
        at
org.apache.derby.iapi.services.loader.ClassInspector.accessible(ClassInspector.java:134)
        at
org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(QueryTreeNode.java:1437)
        ... 17 more
============= begin nested exception, level (1) ===========
java.lang.ClassNotFoundException: gaia.cu7.dal.DerbyBlobTableFunction
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at
org.apache.derby.impl.services.reflect.ReflectClassesJava2.loadClassNotInDatabaseJar(ReflectClassesJava2.java:108)
        at
org.apache.derby.impl.services.reflect.DatabaseClasses.loadApplicationClass(DatabaseClasses.java:232)
        at
org.apache.derby.iapi.services.loader.ClassInspector.getClass(ClassInspector.java:832)
        at
org.apache.derby.iapi.services.loader.ClassInspector.accessible(ClassInspector.java:134)
        at
org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(QueryTreeNode.java:1437)
        at
org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:256)
        at
org.apache.derby.impl.sql.compile.FromVTI.bindVTITables(FromVTI.java:541)
        at
org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:322)
        at
org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:390)
        at
org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
        at
org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
        at
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:245)
        at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:316)
        at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
        at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:802)
        at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        at
org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(EmbedStatement.java:152)
...
============= end nested exception, level (1) ===========
</log>

Seems internal classpath is set properly:

<log>
Executing prepared statement: CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY
('derby.database.classpath', 'APP.kn') :End prepared statement
Database Class Loader started - derby.database.classpath='APP.kn'
2009-03-31 11:03:39.148 GMT Thread[SQL Execution Thread 1,6,main] (XID =
194), (SESSIONID = 1), CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY
('derby.database.classpath', 'APP.kn') ******* null
</log>

Best regards,
Krzysztof
-- 
View this message in context: http://www.nabble.com/Uinable-to-use-Table-function-due-to-java.lang.ClassNotFoundException--while-class-is-clearly-reachable..-tp22478383p22802900.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Krzysztof,

The bug you reported has been fixed in the trunk and the fix has been 
ported to the 10.5 and 10.4 branches. I believe that Myrna plans to spin 
another 10.5 release candidate, so you should see this fix in 10.5.

Thanks again for reporting this bug.

-Rick

Rick Hillegas wrote:
> 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
>>>
>>>
>>>     
>>
>>   
>


Re: Unable to use Table function due to java.lang.ClassNotFoundException while class is clearly reachable..

Posted by Rick Hillegas <Ri...@Sun.COM>.
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
>>
>>
>>     
>
>