try {
if (jndiName == null) {
jndiName = defaultJndiName();
}
InitialContext ctx = createInitialContext();
B ejb = (test.m2.serviceapi.B) ctx.lookup(jndiName);
// don't cache the remote proxy instance, since it might be stale and the server
// of the proxy might have crashed.
if (!useRemoteLookup()) {
setService(ejb);