EJB 3.0 circular dependencies
===

We have hundreds of EJBs. Recently created a new patch which doesn't deploy correctly in our JAS: JBoss 4.2 and gives errors like the following at deployment time:

--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=Locator,service=EJB3
  State: NOTYETINSTALLED
  I Depend On:
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=MaintenanceWorkLoadInterceptor,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=CustomerDao,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=DrilldownEquipmentActivityAction,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=GeoLocDao,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=PackageTaskForInfoTabDao,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=System.jar,name=AutomatedTestLogDao,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=ModstateHistoryDao,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=System.jar,name=TaskSchedulerCommandHandler,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=CommonSupportValidationController,service=EJB3
    jboss.j2ee:ear=Ear.ear,jar=Business.jar,name=AssetEventValidationController,service=EJB3



...hundreds more listed. In any case I believe this is due to a circular dependency. The problem is since we have literally hundreds of EJBs, manually searching through them to try to find where the circular dependency is - is extremely time consuming.

I was thinking about writing a tool to check / find circular dependencies, but not wanting to re-invent the wheel I tried to search google for such a tool but had no luck. I can't believe that there isn't already a tool out there.

What is the best way to find these problems and fix them when you have as many EJBs as we do without manually going through each one?