I have got one single code-base application deployed as two ears A.ear and B.ear which are scoped&isolated through jboss-app.xml and ear-deployer.xml configurations.(i.e just to make clear ,both ears are containing same classes).
I used extensively EJB injections in my applicaiton.
Here I am getting somehow "Non matching type for inject of field: " exception while invoking one of my ejb on one ear.
I debugged it closely, and found that somehow Jboss Proxy references are containing wrong classloader references.(In execution process one ejb StatelessContainer contains right classloader but the other ejb Stateless Container contains wrong classloader) This happens exactly in between one of dependent ejbs invocation(which are injected through EJB annotation). The same works fine if I use my ServiceLocator(ofcourse). Here I strongly suspect EJB injection mechanism.
I debugged littlebit more closesly how jboss is handling ejb injection.
If I have an annotation
@EJB(beanName = "Test") in ejb A then its ref-name env/com.xxx.A/test is binded to Test.
How jboss here logically maintains scoped ejb injection. JBoss does not realize which "Test" to get from which ear.(Actualy in other scoped B.ear it is also having the same ejb-ref name)
Actually If my ear is scoped then I would except injection is also scoped unless I provide mappedName attribute for EJB annotation.
Pleaes help me.
Thanks in advance,