Sorry I thought I tried getBusinessObject method, but it seems I didn't.
So I tried to use it and it works perfect!! Like this:
_____________________________________
@Stateful
public class EJB01Bean implements EJB01{//, EJB01Local{
@EJB Manager manager;
@Resource SessionContext ctx;
public void init() {
EJB01 obj=ctx.getBusinessObject(EJB01.class);
if (obj ==null) Logger.getLogger(getClass().getName()).severe("obj is null");
else manager.register("EJB01", obj);
}
public void method1(int i) {
Logger.getLogger(getClass().getName()).severe("method1 i=="+i);
}
public void remoteMethod(){
Logger.getLogger(getClass().getName()).severe("RemoteMethod called.");
}
}
_____________________________________
@Stateful
public class EJB02Bean implements EJB02{
@EJB Manager manager;
@Resource SessionContext ctx;
public void init() {
EJB02 obj=ctx.getBusinessObject(EJB02.class);
if (obj==null) Logger.getLogger(getClass().getName()).severe("obj is null");
else manager.register("EJB02", obj);
}
public void method2(int i) {
Logger.getLogger(getClass().getName()).severe("method2 i=="+i);
if (true){ // some kind of user independent clause
// get last registered by user (init()) EJB01
EJB01 ejb01=(EJB01)manager.get("EJB01");
//call method
ejb01.remoteMethod();
}
}
}
-----------------------------------------------------------
the output is:
[#|2010-04-14T13:04:17.869+0400|SEVERE|glassfishv3.0|test.EJB01Bean|_ThreadID=28;_ThreadName=Thread-1;|method1 i==123|#]
[#|2010-04-14T13:04:18.169+0400|SEVERE|glassfishv3.0|test.EJB02Bean|_ThreadID=28;_ThreadName=Thread-1;|method2 i==345|#]
[#|2010-04-14T13:04:18.171+0400|SEVERE|glassfishv3.0|test.EJB01Bean|_ThreadID=28;_ThreadName=Thread-1;|RemoteMethod called.|#]
[Message sent by forum member 'lft']
http://forums.java.net/jive/thread.jspa?messageID=396837