-
Hi,
I want to test some EJBs, and I want to test them in a Java Desktop Application.
Had someone something similar tested? is there a tutorial about how one can implement this?
-
Try something like following in your client code. Note that you need to have a client jar to perform this operations.
Hashtable env = new Hashtable(5);
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); //Or your initial context factory
env.put(Context.PROVIDER_URL, "iiop://:");
InitialContext context = new InitialContext(env);
System.out.println("Initial Context Found...");
Object homeObject = context.lookup("");
System.out.println("Home Object Found...");
servicesHome = () PortableRemoteObject.narrow(homeObject,
.class);
System.out.println("Home Narrowed...");
services = servicesHome.create();
System.out.println("Remote Object Created...");
Then using the remote object, call your EJB methods.
Asiri