I might have confued you by my question. Now I'm not sure I need what I asked (or it's possible). The point is the next. In a web-app descriptor you may specify that a servlet must be ran automatically with certain parameters. I wounder if in an ejb descriptor I may place certain records describing which class the server should instanciate to let my beens get objects from the newly created instances. Or simplier to say: if you define a DataSource type under env/jdbs entry then in runtime you may acquire through JNDI a new object then cast it to DataSource type and use it. It's up to the server to instanciate this factory. I want somthing similar but returning my objects. The question is which interface should my factory implement to satisfy conterner's requirements. Or such a possibility doesn't exist and I have to do all the job by my self?