-
1. Re: Deploy multiple instances, same EJB
jamesstrachan Nov 19, 2003 4:29 AM (in response to stanaccy)I poked around in the source code some time ago.
From memory, an internal reference is created for each session bean defined in ejb-jar.xml. The jndi-name attribute is set as default to the ejb-name, and then overwritten if a reference is found in jboss.xml.
So each reference in jboss.xml will overwrite any previous reference - the behaviour that you describe.
You should (I haven't tried this) be able to get round this by defining multiple EJB's that use the same class - as shown below :-
ejb-jar.xml:
...blah blah
<ejb-name>MyEJBOne</ejb-name>
<home...MyEJBHome>
...
...
<ejb-name>MyEJBTwo</ejb-name>
<home...MyEJBHome>
...
...
jboss.xml:
blah blah blah
<ejb-name>MyEJBOne</ejb-name>
<jndi-name>One</jndi-name>
<ejb-name>MyEJBTwo</ejb-name>
<jndi-name>Two</jndi-name>
blah blah
It shouldn't take you long to find out if this works.
James -
2. Re: Deploy multiple instances, same EJB
stanaccy Nov 19, 2003 8:23 AM (in response to stanaccy)Thanks James, thats a similar idea to what we came up with, but it makes our xdoclet generation a little more complex (if its even possible), as well as making the deployment more coupled with development.
Do you know if its supposed to work as we are expecting, or its correctly only giving us a single instance when we define multiple bean/jndi mappings in JBoss.xml ? (The docs sorta suggest that its possible).
Thanks again
Nick -
3. Re: Deploy multiple instances, same EJB
jamesstrachan Nov 20, 2003 5:54 AM (in response to stanaccy)Nick,
I tweaked my deployment files to try this out. See the attached ejb-jar.xml and jboss.xml.
To summarise the results of testing :-
1. Creating another EJB milton/errors/logger2 with the same set of classes results in two parallel deployments of the same bean under different names. See definition in ejb-jar.xml.
2. Looking in jboss.xml, the first session bean definition reassigns the jndi name of logger2 to redirectlogger.
3. The second session bean definition overwrites the reassignment in the first definition. So you only have one JNDI name for the logger2 bean - redirectloggeragain.