1 Reply Latest reply on Jul 8, 2013 4:33 AM by wdfink

    EJB Narrow function - EJB2.1 application migration from jboss 4.3 to jboss eap 6.1.0 alpha

    georgesg

      I am trying to migrate the jboss 4.3 EJB 2.1 Applications to Jboss EAP 6.1.0 Alpha.

       

      In EJB 2.1 Jboss 4.3, we use the narrow functionality to create the EJB Home as below. In Jboss 6.1.0 EAP i dont think the narrow function is supported anymore. In that case, can i directly cast the home object something like i have shown in the Option 2 below ? Kindly advise.

       

      Code snippets of using Narrow Function:


      InitialContext ctx = new InitialContext();

      Object obj = ctx

          .lookup(EJBNameConstant.SET_GOAL_STATE_PROCESS);

       

      SetGoalStateProcess_Home reqHome = (SetGoalStateProcess_Home) PortableRemoteObject

          .narrow(obj, SetGoalStateProcess_Home.class);

      SetGoalStateProcess_Remote reqProcess = reqHome

          .create();

       

      reqProcess.execute(req);

       

      Option 2:

       

       

      InitialContext ctx = new InitialContext();

      Object obj = ctx

          .lookup(EJBNameConstant.SET_GOAL_STATE_PROCESS);

       

      //SetGoalStateProcess_Home reqHome = (SetGoalStateProcess_Home) PortableRemoteObject .narrow(obj, SetGoalStateProcess_Home.class);

       


      SetGoalStateProcess_Home reqHome = (SetGoalStateProcess_Home)obj;

       

      SetGoalStateProcess_Remote reqProcess = reqHome

          .create();

       

      reqProcess.execute(req);