extending local interface to my own interface
I use my on business interface to hold EJB methods.
publicinterface Testextends ServiceInterface{
publicvoid test(int sum)throws EJBException;
}
publicclass TestImplimplements Test{
publicvoid test(int sum)throws EJBException{
//do something
}
}
publicinterface TestLocal
extends
my.own.test.Test,
javax.ejb.EJBLocalObject{
}
How to make EJB call from client now? Is it normal local EJN lookup?
Context ctx =new InitialContext();
Object o = ctx.lookup("local:ejb/ejb/TestHome");
TestLocalHome testHome = (TestLocalHome)o;
TestLocal local = testHome.create();
local.test(100);
[1584 byte] By [
basti78a] at [2007-11-27 3:42:24]

# 1
Hi Basti,
It's not recommended to declare EJBException on the signature of the Local business methods.
That's a runtime exception that is considered a system exception so there's always the possibility
that it will be thrown.
Also, the portable way to lookup a local ejb dependency is through the java:comp/env/
namespace.Access of "local:" is not portable.You need to define an ejb-local-ref
and then look up the ejb-local-ref's ejb-ref-name via
ctx.lookup("java:comp/env/<ejb-ref-name>)
Just to be clear, the "client" in this case must be part of the same application as the target
EJB and either a web component or EJB.The Local EJB view is not accessible from a
separate JVM.
--ken