generic EJB with classloader

Hello,

I want to dynamically reload a class into an ejb on runtime. Is is right, that this can only be done by creating a new classloader for every reload?

And if so, how about other dynamic classes, which are used in the first reloaded class. They then have to be reloaded again by the same classloader, right? This means, that I always have to create a new classloader for reloading all new classes, if only one of the classes in this group has changed, right?

Is it a good idea to check inside the ejb, if a class has changed, so that the ejb creates a new internal classloader for loading all needed classes new or should a new ejb be created to load the classes again?

Is there a possibility to debug the reloaded classes?

regards,

Peter

[785 byte] By [p.fischera] at [2007-11-27 1:45:33]
# 1

Hi Peter,

None of this is portable. Java EE applications do not have the ability to dynamically load classes

that were not packaged when the application was deployed.

A better option is to investigate the support that many application servers have for fast redeployment.For example, the EJB container in the Java EE SDK has pretty fast redeployment

since it does not generate any static artifacts such as stubs or wrapper classes. All such internal

derived classes are generated dynamically, which makes deployment and redeployment relatively

quick.

--ken

ksaksa at 2007-7-12 1:06:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Hello ken,

> None of this is portable. Java EE applications do

> not have the ability to dynamically load classes

> that were not packaged when the application was

> deployed.

I want to load the classes as byte[] from an database. Is there no way or depends it on some security-configurations?

> A better option is to investigate the support that

> many application servers have for fast redeployment.

> For example, the EJB container in the Java EE SDK

> has pretty fast redeployment

> ince it does not generate any static artifacts such

> as stubs or wrapper classes. All such internal

> derived classes are generated dynamically, which

> makes deployment and redeployment relatively

> quick.

Maybe, but we will have several bl-functions, which are located in sessionbeans. If I have to change one on runtime, than I have to redeploy all which means to stopp all for this time. Right?

regards,

Peter

p.fischera at 2007-7-12 1:06:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
You might be able to edit your vendor's java security policy to grant theappropriate permissions.However, understand that application loadingof classes goes well against the Java EE programming model, so itmakes your app non-portable. --ken
ksaksa at 2007-7-12 1:06:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...