Domain domain = getDomain("Stateful Bean");
Hashtable<?,?> ctxProperties = null;
Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit());
deployment.setPersistenceManagerFactoryRegistry(getBootstrap().lookup("EJB3PersistenceManagerFactoryRegistry", PersistenceManagerFactoryRegistry.class));
JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatefulBean.class);
StatefulContainer container = new StatefulContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
// TODO: wickedness
container.instantiated();
// A container does not register itself
Ejb3Registry.register(container);
// Register the Container in ObjectStore (MC)
String containerName = container.getObjectName().getCanonicalName();
// AbstractBeanMetaData bmd = new AbstractBeanMetaData(containerName, StatefulContainer.class.getName());
// KernelControllerContext context = getBootstrap().getKernel().getController().install(bmd, container);
// if(context.getError() != null)
// throw context.getError();
Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);