You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Ilkka Priha <ip...@surfeu.fi> on 2003/08/04 11:59:19 UTC

Deep option in MetaDataManager of RC4 not fully compatible with RC3

Hi

In RC4, mergeDescriptorRepository(repository) calls internally a new 
mergeDescriptorRepository(target, source, deep) method with the deep 
option set to true. The deep option invokes serialization through 
Commmons' SerializationUtils using the ObjectInputStream class, which in 
turn calls Class.forName(name) with the default class loader to resolve 
classes. However, the ClassHelper, which has parsed the original XML of 
the source repository, resolves classes with the context class loader 
returned by Thread.getContextClassLoader(), which can be different from 
the default class loader. If the class is only defined by the context 
class loader, the attempt to serialize it will throw ClassNotFoundException.

This can be avoided by calling the new method explicitly with the deep 
option set to false, but maybe a note in javadoc should be added.

Please, don't remove the context class loader support, it's essential 
when generating persistent classes dynamically :-)

-- Ilkka





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Deep option in MetaDataManager of RC4 not fully compatible with RC3

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Ilkka,

----- Original Message -----
From: "Ilkka Priha" <ip...@surfeu.fi>
To: <oj...@db.apache.org>
Sent: Monday, August 04, 2003 11:59 AM
Subject: Deep option in MetaDataManager of RC4 not fully compatible with
RC3


> Hi
>
> In RC4, mergeDescriptorRepository(repository) calls internally a new
> mergeDescriptorRepository(target, source, deep) method with the deep
> option set to true. The deep option invokes serialization through
> Commmons' SerializationUtils using the ObjectInputStream class, which
in
> turn calls Class.forName(name) with the default class loader to
resolve
> classes. However, the ClassHelper, which has parsed the original XML
of
> the source repository, resolves classes with the context class loader
> returned by Thread.getContextClassLoader(), which can be different
from
> the default class loader. If the class is only defined by the context
> class loader, the attempt to serialize it will throw
ClassNotFoundException.
>
sorry, my fault!

> This can be avoided by calling the new method explicitly with the deep
> option set to false, but maybe a note in javadoc should be added.
>

mergeConnectionRepository(ConnectionRepository repository)
mergeDescriptorRepository(DescriptorRepository repository)

now use deep copy option set to false (think this was the behaviour
before I foozle the code). I also add a javadoc comment.

> Please, don't remove the context class loader support, it's essential
> when generating persistent classes dynamically :-)
>

I would never be so stupid and change the class loader behaviour
of existing classes ;-)

Thanks for the patch!

regards,
Armin

> -- Ilkka
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org