Can anyone help by firstly telling me if it’s at all possible and safe to dynamically load EJB's at run time from within an EJB application?

Problem. In my EJB application I would like to selectively load an appropriate business service
in the form of an EJB session bean. The selection will be made from within a message driven bean that receives a message indicating the business service to be run, This could be one of 50 or so session beans

Rather than declare each session bean statically within the MDB I wondered if there was any clean way of dynamically loading the required bean. My MDB does look-up an entity bean so any resource information relative to the required bean could be retrieved from there.

I've been experimenting with a number of suggestions I've found that are aimed more towards providing a client sided solution but I’ve struggled to see how to implement such a solution within EJB.

There then remains the question of the ejb references, which I’m assuming, would still need to be applied associating the MDB with each of the session beans.

It’s just that it seems a lot of bloat having to declare every (business service) session bean that may be required, but then there’s the performance issue, if static declarations are going to provide a more robust solution along with better performance then I guess I’ll stay with that.

Application server is Oracle 10gAS.

Any suggestions or code examples would be very much appreciated.