You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Eung-ju Park <co...@isoft.co.kr> on 2001/02/26 10:21:36 UTC

Why DataSourceComponent do not load jdbc driver internaly?

Why JdbcDataSource do not load jdbc driver internaly?
I load jdbc driver class in my block.
but block's class loader is child of JdbcDataSource's class loader
therefore JdbcDataSource do not load jdbc driver. :-)
because JdbcDataSource's class loader do not access parents class loader.
...

PS: org.apache.avalon.util.datasource.DataSourceComponent use deprecated
Configuration related classes.
PS: sorry for ugly english...... :-(




Re: Why DataSourceComponent do not load jdbc driver internaly?

Posted by Eung-ju Park <co...@isoft.co.kr>.
naturally my jdbc driver and external jars in <dist-base>/lib
and specify Class-Path: ../lib/mysql.jar ../lib/velocity.jar in bar's
manifest file.
but it's not work.

JdbcDataSource is loaded by avalon-loader.jar's ClassLoader. ->A
but jdbc driver loaded by my blocks's ClassLoader. -> B
ClassLoader B is child of A.
because ClassLoader A do not find jdbc driver which loaded by ClassLoader B.

I fork datasource.* code to my own version and packaging with block's bar.
Just then my problem solved. :-)

----- Original Message -----
From: "Peter Donald" <do...@apache.org>
To: "Avalon Development" <av...@jakarta.apache.org>
Sent: Tuesday, February 27, 2001 4:17 PM
Subject: Re: Why DataSourceComponent do not load jdbc driver internaly?


> At 09:31  26/2/01 -0500, Berin Loritsch wrote:
> >> I load jdbc driver class in my block.
> >> but block's class loader is child of JdbcDataSource's class loader
> >> therefore JdbcDataSource do not load jdbc driver. :-)
> >> because JdbcDataSource's class loader do not access parents class
loader.
> >> ...
> >
> >I see. In order for this to be usable in multiple environments, we need
> >to have the JdbcDataSource load the class at Config time.  That can be
> >fixed.
>
> Another alternative in the meantime is to place the jdbc driver jars in
> <dist-base>/lib which I think will work.
>
> Cheers,
>
> Pete
>
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof."                   |
> |              - John Kenneth Galbraith               |
> *-----------------------------------------------------*
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
>



Re: Why DataSourceComponent do not load jdbc driver internaly?

Posted by Peter Donald <do...@apache.org>.
At 09:31  26/2/01 -0500, Berin Loritsch wrote:
>> I load jdbc driver class in my block.
>> but block's class loader is child of JdbcDataSource's class loader
>> therefore JdbcDataSource do not load jdbc driver. :-)
>> because JdbcDataSource's class loader do not access parents class loader.
>> ...
>
>I see. In order for this to be usable in multiple environments, we need
>to have the JdbcDataSource load the class at Config time.  That can be
>fixed.

Another alternative in the meantime is to place the jdbc driver jars in
<dist-base>/lib which I think will work.

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Re: Why DataSourceComponent do not load jdbc driver internaly?

Posted by Berin Loritsch <bl...@apache.org>.
Eung-ju Park wrote:
> 
> Why JdbcDataSource do not load jdbc driver internaly?

It is set up for an environment where the class is loaded once.
The idea is that you "install" the driver yourself by loading
it's class.  In a servlet environment, this can be done at
init time--which is perfect for this application.  That is
why it was designed this way.

> I load jdbc driver class in my block.
> but block's class loader is child of JdbcDataSource's class loader
> therefore JdbcDataSource do not load jdbc driver. :-)
> because JdbcDataSource's class loader do not access parents class loader.
> ...

I see. In order for this to be usable in multiple environments, we need
to have the JdbcDataSource load the class at Config time.  That can be
fixed.

> PS: org.apache.avalon.util.datasource.DataSourceComponent use deprecated
> Configuration related classes.

Yes I know.  I haven't gotten around to fixing that one yet.  The problem
is that I really don't have enough time.  It is used in Cocoon which hasn't
been upgraded to the new Configuration scheme yet.  This is painful, and
will do it when I have time...

> PS: sorry for ugly english...... :-(

No appology needed.