I have an interface. with several implentation developped as stateless session.
In a session bean according to an algorithm I choose one of the implementation. Each implementation as a name and is deployed in the same ear as the invoker
my code looks like:
@Resource SessionContext ctx; public void myMethod() { if (...) { ctx.lookup("earName/myImpl1/local"); } else if (...) { ctx.lookup("earName/myImpl2/local"); } ... }
yes, you can use @LocalBinding and @RemoteBinding on the implementing class to override the default JNDI name (which has the EAR-name).
OR
provide a jboss.xml and specify the JNDI names there.