0 Replies Latest reply on Apr 2, 2008 3:39 AM by Guy Coleman

    Injecting EJB2 entity homes into EJB3 beans

    Guy Coleman Newbie

      Should I be able to inject EJB2 homes into EJB3 beans?. This used to work on 5.0.0.Beta4 but doesn't with the latest 5.0.0 HEAD build - I'm trying to upgrade due to a problem with JBossWebRealm (fixed in r69776).

      I've got an EJB3 SLSB declared using annotations. I'm injecting an EJB2 entity home into it using ejb-jar.xml:

      @Stateless(name = "TaskManager")
      @Local(TaskManager.class)
      @TransactionAttribute(REQUIRED)
      public class TaskManagerBean implements TaskManager
      {
       protected ScheduledTaskHome scheduledTaskHome;
      ...
      }
      


      <session>
       <ejb-name>TaskManager</ejb-name>
       <ejb-local-ref>
       <ejb-ref-name>ejb/ScheduledTaskHome</ejb-ref-name>
       <ejb-ref-type>Entity</ejb-ref-type>
       <local-home>util.timer.ScheduledTaskHome</local-home>
       <local>util.timer.ScheduledTask</local>
       <ejb-link>ScheduledTask</ejb-link>
       <injection-target>
       <injection-target-class>util.timer.TaskManagerBean</injection-target-class>
       <injection-target-name>scheduledTaskHome</injection-target-name>
       </injection-target>
       </ejb-local-ref>
      </session>
      


      The ScheduledTask entity deployed without any errors. The problem appears to be the SLSB thinks that the entity dependency is EJB3:

      08:24:41,721 ERROR [ProfileServiceBootstrap] [main] Failed to load profile: Summary of incomplete de
      ployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
      
      jboss.j2ee:ear=app.ear,jar=server-utils-ejbs.jar,name=TaskManager,service=EJB3
       -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService **}
       -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.j2ee:ear=app.ear,name=ScheduledTask,servic
      e=EJB3,* **}