java - JNDI Lookup of local EJB (no @EJB) -
i have requirement i'm asked load both remote , local ejbs jndi lookup, without @ejb annotation.
my ejb defined follows:
@remote public interface myobjectinterfaceremote extends myobjectinterface { } @local public interface myobjectinterfacelocal extends myobjectinterface { } public interface myobjectinterface { // bunch of methods both remote , local ejbs inherit } @remote(myobjectinterfaceremote.class) @local(myobjectinterfacelocal.class) public class myobjectejb implements myobjectinterfacelocal, myobjectinterfaceremote { //implementation of methods inherited myobjectinterface. } i'm using code lookup remote ejb:
private myobjectinterfaceremote getejb() throws namingexception { initialcontext context = new initialcontext(); return (myobjectinterfaceremote) context.lookup(myobjectinterfaceremote.class.getname()); } it works fine, if make method this:
private myobjectinterfacelocal getlocalejb() throws namingexception { initialcontext context = new initialcontext(); return (myobjectinterfacelocal) context.lookup(myobjectinterfacelocal.class.getname()); } i
javax.naming.namenotfoundexception: context: backslash-pcnode03cell/nodes/backslash-pcnode03/servers/server1, name: myobjectinterfacelocal: first component in name myobjectinterfacelocal not found. [root exception org.omg.cosnaming.namingcontextpackage.notfound: idl:omg.org/cosnaming/namingcontext/notfound:1.0] [...] what missing? have use different lookup local ejb?
note: if use
@ejb myobjectinterfacelocal ejb; the local ejb gets succesfully loaded.
have tried below code?
context.lookup("ejblocal:"+myobjectinterfacelocal.class.getname()) webshpere uses different default binding pattern remote , local interfaces.
Comments
Post a Comment