Crete a new EJB instance using OpenEJB.
// -------------------------------------------------- ObjectFactory Methods
Object beanObj = null;
if (obj instanceof EjbRef) {
Reference ref = (Reference) obj;
String factory = DEFAULT_OPENEJB_FACTORY;
RefAddr factoryRefAddr = ref.get("openejb.factory");
if (factoryRefAddr != null) {
// Retrieving the OpenEJB factory
factory = factoryRefAddr.getContent().toString();
}
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, factory);
RefAddr linkRefAddr = ref.get("openejb.link");
if (linkRefAddr != null) {
String ejbLink = linkRefAddr.getContent().toString();
beanObj = (new InitialContext(env)).lookup(ejbLink);
}
}
return beanObj;