try
{
// Attempt to get local EJB3 Registrar
//TODO EJBTHREE-1403
// This is the wrong way to determine local/remote
Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
// Local lookup succeeded, so use it
try
{
Object pfObj = registrar.lookup(proxyFactoryRegistryKey);
assert pfObj != null : ProxyFactory.class.getName() + " from key " + proxyFactoryRegistryKey + " was null";
assert pfObj instanceof ProxyFactory : " Object obtained from key " + proxyFactoryRegistryKey
+ " was expected to be of type " + ProxyFactory.class.getName() + " but was instead " + pfObj;
proxyFactory = (ProxyFactory) pfObj;
}