Hi, admin,
I tried to code option 2 and it works for stateless bean:
Code: Select all
@Stateless
@Local(SLSBALocal.class)  //This interface is not shown.
@LocalBean
public class SLSBA  {
	@EJB SLSBB beanB;
 @Resource SessionContext context;
    public void method1(){
    	System.out.println("SLSB A method a calls SLSB B method2 ");
         beanB.method2();
    	 
    }
    
    public void method3(){
    	System.out.println("Call method 3 .");
    }
}
Code: Select all
@Stateless
public class SLSBB {
	@Resource SessionContext context;
         //inject another instance of stateless bean SLSBA
         //inject the same instance of bean SLSBA if SLSBA is a    
         //singleton bean.
	 @EJB SLSBA beanA;
	
         public void method2(){
    	    System.out.println("SLSB B method b");
    	    beanA.method3();
         }   	
 }
The code works.
By the way, in the question, method a() called b() and b() calls a() and so on, it will  never end.