Hi,

I used dynamic class reloading on a commercial J2EE server and, believe me,
it brings far more problems than it solves.

First, when you dynamically reload a class here is what can happen:

webapp start under classloader instance x
webapp instanciate class A and store in session
session.setAttribute(someKey,someA)
class A has changed on disk, classloader reload it using a special class
loader
and marking this class to be handled by this new classloader (y)

now this code
A someA = (A)session.getAttribute(someKey)
will through a ClassCastException because
A.getClass() != session.getAttribute(someKey).getClass()
while
A.getClass().getName().equals(session.getAttribute(someKey).getClass().getName())

is true :)

All code involving static method/static variables is subject to such
breakdown.
More funny, you can end up in some condition instanciating old version
of classes.

Thrust me, when dynamically classloading, half of code breaks like this
most of time,
sometimes silently, and you end up crazy, trying to debug a code which
in fact is
not bugged.

If your webapp is particulary slow to start and you need faster
development, better take a look at unit testing
of deactivate parts of your webapp when debugging!

dumbQuestionsAsker _ a écrit :

> can somone give me an information?
> I want to know if it is possible to past and load classes into
> web-inf/classes path without beeing forced to reload the whole webapp ?
>
> _________________________________________________________________
> 10 Mo pour vos pièces jointes avec MSN Hotmail !
> http://www.imagine-msn.com/hotmail/default.aspx?locale=fr-FR
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to