jaikiran pai [https://community.jboss.org/people/jaikiran] created the 
discussion

"Re: Multiple session beans with the same interface"

To view the discussion, visit: https://community.jboss.org/message/827308#827308

--------------------------------------------------------------
It's perfectly valid for multiple EJBs to implement the same interface. The 
error isn't because multiple EJBs are implementing the same interface, but it's 
because the usage of the @EJB in your application is such that the container 
has no idea which of the multiple EJB implementations you are trying to setup 
into the java:global namespace via the @EJB usage:

@Stateless
@EJB(name = "java:global/coo/TestBean1", beanInterface = TestBean.class)
public class TestBean1 implements TestBean{
}
 
@Stateless
@EJB(name = "java:global/coo/TestBean2", beanInterface = TestBean.class)
public class TestBean2 implements TestBean{


The spec allows you to narrow it down to the specific EJB implementation. You 
can do so by using the "beanName" attribute of the @EJB where you can specify 
the name of the bean (which by default is the bean implementation's simple 
class name). So you should change that above code to:

@Stateless
@EJB(name = "java:global/coo/TestBean1", beanInterface = TestBean.class, 
*beanName="TestBean1"*)
public class TestBean1 implements TestBean{
}

@Stateless
@EJB(name = "java:global/coo/TestBean2", beanInterface = TestBean.class, 
*beanName="TestBean2"*)
public class TestBean2 implements TestBean{
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/827308#827308]

Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to