I have an ejb-3 compatible ejb let's say
@Remote interface Hai{ String sayHai(); } Stateless(name = "xxx", mappedname="yyy") public class HaiImpl implements Hai{ public String sayHai(){ return "Hai"; } }
And I need to create a stub for this EJB. but I do not want to use the websphere tool or the maven tool. Is there a way to generate a stub using jdk?
When creating a remote client
Hai hai = (Hai)ctx.lookup("yyy#com.zz.Hai"); System.out.println(hai.sayHai());
will work in weblogic or jboss, but in websphere, even this is ejb 3, you need to write like this
Object o = ctx.lookup("yyy"); Hai hai = (Hai)javax.rmi.PortableRemoteObject.narrow(o,Hai.class); System.out.println(hai.sayHai());
In this case, if the stub is not presented on the client, it will throw an exception, there is a way to generate a stub using the websphere ejb stub generatorater tool. But I do not want to use any platform-specific tools.
source share