Circular injection of EJBs

Solution Unverified - Updated -

Issue

  • One EJB injects a reference to another EJB which in turn injects a reference back to the first EJB This results in that the EJB container can't resolve the dependency relationship and therefore the deployment fails.
    Error in server log "DEPLOYMENTS MISSING DEPENDENCIES"
DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "jboss.j2ee:ear=Test.ear,jar=ejbJAR.jar,name=Test,service=EJB3" is missing the following dependencies:
    Dependency "<UNKNOWN jboss.j2ee:ear=Test.ear,jar=ejbJAR.jar,name=Test,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jndi:Test/TestBean/aaa.bbb.TestLocal' **")
  • The code is something like following:
@Stateless
public class TestBean implements TestLocal {
    @EJB
    TestLocal self;

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 4.x
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.