[jboss-user] [EJB 3.0] - Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-

jaikiran do-not-reply at jboss.com
Mon Jun 9 04:44:39 EDT 2008


"Nouredine13" wrote : 	
  | this does not work when the interface has several implementations, in this case the following error is generated:
  | 
  | could not resolve global JNDI name for @EJB for container Hello1Bean : reference class: com.gemalto.session.Hello2Local ejbLink:  duplicated in cyclic.jar
  | 
  | 	
  | the question is: how to not use the declaration of reference with EJBs when the interface has several implementations?
  | 
  | Thank's 
  | 

I think i understand what you are saying. If you have multiple (bean) implementations for the same interface, you can inject the beans as follows:
  | 
  | Hello1Bean class:
  | 
  |  
  | @Stateless 
  | public class Hello1Bean implements Hello1 {
  |  
  | @IgnoreDependency
  | @EJB(name="ejb/Hello2",beanName="Hello2Bean")
  | private Hello2 hello;
  | 
  | }
  |  
  | 
  | Hello2Bean Class :
  | 
  |  
  | @Stateless 
  | public class Hello2LocalBean implements Hello2Local {
  |  
  | @IgnoreDependency
  | @EJB(name="ejb/Hello1",beanName="Hello1Bean")
  | private Hello1 hello;
  | 
  | }

Note, the use of beanName in the @EJB annotation at field level. If this still does not solve your problem, then post back with the details.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156598#4156598

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156598



More information about the jboss-user mailing list