I have asked the last time the problem of circular dependencies between EJB, there is someone who responded me and telling me to use the annotation @IgnoreDependency to one of the instance of Ejb injection.
it solves the problem by half:
I explain: when I use default injecting dependance with @EJB without specifying the name attribute, Jboss solve reference, in this case @ IgnoreDependency works well. By when I specifie the name of reference( @EJB(name="ejb/someEJB"...) that does not work.
example:
Hello1Bean classe :
@EJBs(
{ @EJB(name="ejb/Hello2", beanInterface=Hello2.class, beanName="Hello2Bean")
})
public @Stateless class Hello1Bean implements Hello1 {
@IgnoreDependency
@EJB(name="ejb/Hello2")
private Hello2 hello;
and Hello2Bean Classe :
@EJBs(
{@EJB(name="ejb/Hello1", beanInterface=Hello1.class,beanName="Hello1Bean")
})
public @Stateless class Hello2LocalBean implements Hello2Local {
@IgnoreDependency
@EJB(name="ejb/Hello1")
private Hello1 hello;
with this case , i Have this probleme :
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:jar=cyclic.jar,name=Hello2Bean,service=EJB3
State: NOTYETINSTALLED
I Depend On:
jboss.j2ee:jar=cyclic.jar,name=Hello1Bean,service=EJB3
Depends On Me:
jboss.j2ee:jar=cyclic.jar,name=Hello1Bean,service=EJB3
ObjectName: jboss.j2ee:jar=cyclic.jar,name=Hello1Bean,service=EJB3
State: NOTYETINSTALLED
I Depend On:
jboss.j2ee:jar=cyclic.jar,name=Hello2Bean,service=EJB3
Depends On Me:
jboss.j2ee:jar=cyclic.jar,name=Hello2Bean,service=EJB3
if someone has a solution, I currently work on the migration of a real application, and I have a major problem for progress.
Thank's a lot.