users@glassfish.java.net

Re: 2 ejb with the same local interface

From: <glassfish_at_javadesktop.org>
Date: Wed, 20 Jan 2010 07:15:02 PST

This should work. Any number of EJB components can implement the same interface. If the interface is FooLocal, you would have :

@Stateless
public class ABean implements FooLocal { ... }

and

@Stateless
public class BBean implements FooLocal { ... }

ABean's ejb-name is "ABean". BBean's ejb-name is "BBean".

To acquire an EJB reference to a bean that implements FooLocal, in addition to specifying the type as FooLocal, you'll need to disambiguate the ejb-name.

@EJB(beanName="ABean")
public FooLocal fooLocalRef;

or

@EJB(beanName="BBean")
public FooLocal fooLocalRef;

Is this equivalent to what you tried? If so, what exact error did you receive?
[Message sent by forum member 'ksak' (kenneth.saks_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=381976