You will need to duplicate configuration for the bean instance in your ejb-jar.xml file (and then the corresponding jndi-name mapping from two different EJB names to two separate JNDI names in jboss.xml).
So there's no way around duplicating the config in the standard deployment descriptors. To avoid maintenance change issues you do not have to maintain and use the deployment descriptors directly in your source tree. It is possible to create XSL scripts that create the duplicates into ejb-jar.xml descriptors. This requires that you're somewhat familiar with the XML style sheets though.
I use this myself to avoid writing and maintaining a lot of duplicate XML pieces for multiple deployments and configurations of the same bean. Unfortunately most scripts are specific to the bean implementations and not themselves reusable.
i had read some other postings about multiple instances of applications in one jboss.
At least there is something that confuse me.
You said is it not necessary to change any line of code.
I'm asking my self how your jndi lookups do work in your code when you have configurable jndi names. Is there a trick? I'm using xdoclet and this tool is very cool. Since all the jndi Names are in the *Util class, may be xdoclet can help me? Do you have any hints for me?
Thanks a lot!!!!
Only use comp/env namespace in your code. The mapping from global or java: namespace to the comp/env namespace is done during deployment (resource tags in jboss.xml).