private ResourceReferenceFactory buildManagedObjectReference(Module module, AbstractNameQuery containerId, Class iface) throws DeploymentException {
Configuration localConfiguration = module.getEarContext().getConfiguration();
try {
// first, lookup in configuration
localConfiguration.findGBean(containerId);
} catch (GBeanNotFoundException e) {
// second, lookup in kernel
Set results = this.kernel.listGBeans(containerId);
if (results == null || results.isEmpty()) {
throw new DeploymentException("Cannot resolve managed object ref " + containerId);