I have my ears something like this,
myEjbs.jar expose only local interfaces, When I deploy both ear files in same jboss instance, MyEar1.ear will be deployed succesfully. When server tries to deploy MyEar2.ear it fails because it cannot deploy myEjbs.ar since same ejb(s) with same jndi are already deployed in MyEar1.ear.
Exact exception I am getting is,
javax.management.InstanceAlreadyExistsException: jboss.j2ee:jndiName=MySession,service=EJB already registered.
My question here is, In JBoss, You cannot deploy same ejbs with same local jndi names across multiple ears???
However same hierarchy works fine in Weblogic.
In jboss "Local Ejb" means local to server instance (hence you cannot have same ejb with same jndi across ears ) In case of Weblogic, "Local Ejb" means local to EAR. or I am wrong ???
I am using , JBoss 4.2.0 CP06, EJB2
Hi , I have the same example , work fine for me in Jboss 4.2.2.GA , but I have the same InstanceAlreadyExistsException error in Jboss 5.1.0.GA .
I need only one EJB instance reference running in the server used by the all EARS. Taht work in jboss4.2.2. but not work in Jboss 5.1 .
I have found the work around for such scenario,
In JBoss, unlike Weblogic, you cannot deploy same local ejb with same local jndi name across multiple ears. ( However this is nowhere specified in ejb specification ).
Work around for such scenario in JBoss is,
While deploying local ejbs in JBoss, dont specify the jndi for ejbs ( i.e. Remove the jboss.xml file ). Server will assign a random jndi name to it.
Make use of ejb-local-ref in web.xml, just configure the ejb you want access in web.xml
<ejb-link>MySession</ejb-link> //give the same name here ( ejb name )
This you have to do it in all ear files.