0 Replies Latest reply on Nov 1, 2010 10:30 AM by notify

    Component.getInstance("MyRemote.class");

    notify

      I am confused as to whether it is best practice to use Component.getInstance(MyRemote.class) or just use JNDI lookup.


      I have a Seam RESTful bean which needs to access one of my SF Session Beans.


      @Name("restfulBean")
      @Path("/restfulBean")
      @Scope(ScopeType.SESSION)
      public class RESTfulBean implements NOTiFYPiNPOiNTConstants, Serializable {
      



      I can access the SFSB fine using;


      final Context ic = getInitialContext();
      o = ic.lookup("ejb/PostcardRemote");
      postcardRemote = (PostcardRemote) PortableRemoteObject.narrow(o, PostcardRemote.class);
      


      The calling the method;


      @GET
      @Path("/restfulByDomain/{domain}")
      @Produces("application/xml")
      public String getRESTfulByDomain(@PathParam("domain") String domain) {
           
          log.info(">>>>> getRESTfulByDomain domain = " + domain);
           
          postcardRemote.getPostCardsByDomain(domain);
                
          return "is this working?";
      }
      



      What is the correct/best way/method to access a SF or SL Session Bean from within a SEAM RESTful bean?


      Thanks.