Moderator: admin

Post Reply
Manas Ranjan
Posts: 2
Joined: Sat May 14, 2016 9:11 am


Post by Manas Ranjan » Sat May 14, 2016 9:23 am

Code: Select all

A stateless session bean S1 uses another stateless session bean S2 and requests a dependency injection using the following statement (contained in S1's code): @EJB(beanName="ejb/S2", beanInterface=S2Local.class) 

S2Local interface is as follows:  
package com.enthu.ejbplus;
import javax.ejb.Local;
public interface S2Local { String m1();    } 

 Given the above, complete the following S2Bean's code so that bean S1 will work as expected.  
package com.enthu.ejbplus;
 import javax.annotation.*; 
import javax.ejb.*; 
 // insert lines here...     
 @Resource     SessionContext sctx; 
  public String m1(){ return "hello!"; } }
Can i choose the below option as well ? Because the local business interface is annotated with @Local so i think if Bean hasn't implemented the interface then its ok. Please correct me if i am wrong.

public class S2Bean {

Site Admin
Posts: 8622
Joined: Fri Sep 10, 2010 9:26 pm

Re: enthuware.oce-ejbd.v6.2.527

Post by admin » Sun May 15, 2016 8:51 pm

No, as the explanation to this option says, "This is invalid because S2Bean neither has 'implements S2Local' part nor does it specifies its business interface using @Local or @Remote."

How will the container know that this bean implements the interface required by the client?

If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest