[ 
http://issues.apache.org/jira/browse/DERBY-556?page=comments#action_12357763 ] 

Jeremy Boynes commented on DERBY-556:
-------------------------------------

This problem will not manifest if the procedure classes are on the system 
classpath (${CLASSPATH}) - you need to be playing tricks with classloaders, 
hence the relation to GERONIMO-1001 :-)

Assume that MathUtils.jar is not on the system classpath but is on the 
classpath for a user defined classloader CL. If you set the Thread's context 
classloader (TCCL) to be CL and then connect to Derby using an embedded 
connection, the procedure classes will successfully be loaded from CL.

However, if you then start a network server (with CL as TCCL), worker threads 
created by the network server do not have the TCCL thread set and hence the 
procedure classes will not be found. This was where the problem manifested in 
Geronimo as the application classes were present in a RAR (with CL being the 
RAR's classloader) but the Derby engine was present in a parent classloader 
(the appserver's).

I think a safe fix for this is for the network server to set the TCCL of its 
worker threads either to some classloader explictly set as a parameter during 
startup or to the TCCL in place when it is started.

There is no issue with classes being loaded if the classloader is defined using 
derby.database.classpath

If that makes sense, let me know; if not, I will try and put together an 
explicit testcase. I did look at fixing this but ran into issues with how the 
network server was being started by some of the monitor code and then 
backburnered this issue when we had the workaround using 
derby.database.classpath

> NetworkServer does not set thread context classloader
> -----------------------------------------------------
>
>          Key: DERBY-556
>          URL: http://issues.apache.org/jira/browse/DERBY-556
>      Project: Derby
>         Type: Bug
>   Components: Network Server
>     Versions: 10.1.1.0
>     Reporter: Jeremy Boynes
>     Assignee: Rick Hillegas
>  Attachments: MathUtils.jar, z.sql, zz.sql
>
> The NetworkServer does not set the thread context classloader which is used 
> to load the implementations of stored procedures. As a result, procedure 
> implementations must be present in the classpath of the engine itself; this 
> differs from embedded mode where classes may be located in the application.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to