// Get the Bean Instantiator
final String appName = deployment.getAppName();
final String moduleName = deployment.getDeploymentUnit().getShortName();
final String beanInstantiatorAttachmentName = BeanInstantiatorRegistration.getInstantiatorRegistrationName(
appName, moduleName, ejbName);
final BeanInstantiator beanInstantiator = Ejb3RegistrarLocator.locateRegistrar().lookup(
beanInstantiatorAttachmentName, BeanInstantiator.class);
if (beanInstantiator == null)
{
throw new IllegalStateException(deployment + " must contain an attachment of name "
+ beanInstantiatorAttachmentName);