You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Forrest Xia <fo...@gmail.com> on 2010/02/24 16:05:21 UTC

how openejb inject stateful session bean instance when there are two EJBs with the same local business interface

Hi experts,

I encounter a problem when using EJB in Geronimo server, I know G uses
OpenEJB.

My app is like this.

1. there is a stateful session bean called StatefulBeanA. When deploying to
G server, I see two bean instances generated. One is via ejb-jar.xml, named
as ejb.jar/ejb/StatefulBeanA(a); another is via annotation on the bean
class, deploymentId as ejb.jar/StatefulBeanA(b).

@Stateful
public class StatefulBeanA implements StatefulBeanALocal {
 ...
}

@Local
public interface StatefulBeanALocal {
 ...
}

2. then I want to use the EJB in a servlet via @EJB annotation. For G 2.1.5
snapshot, I see (b) injected into the servlet, but for G 2.2, (a) is
injected. I compared OpenEJB version. G 2.1.5 snapshot uses 3.0.2-SNAPSHOT,
G 2.2 uses 3.1.2.

So my question is how openEJB determine which one to inject when two bean
instances share the same local business interface? Please advise. thanks!

Regards, Forrest