EjbModuleBuilder.EarData earData = EjbModuleBuilder.EarData.KEY.get(module.getRootEarContext().getGeneralData());
AppInfo appInfo = earData != null ? earData.getAppInfo() : new AppInfo();
JndiEncInfoBuilder jndiEncInfoBuilder = new JndiEncInfoBuilder(appInfo);
JndiEncInfo moduleJndi = new JndiEncInfo();
JndiEncInfo compJndi = new JndiEncInfo();
String moduleId = module.getName();
jndiEncInfoBuilder.build(specDD, "GeronimoEnc", moduleId, module.getModuleURI(), moduleJndi, compJndi);
//No need to keep the persistence references, as they will be handled by Geronimo
appInfo.globalJndiEnc.persistenceContextRefs.clear();
appInfo.globalJndiEnc.persistenceUnitRefs.clear();
appInfo.appJndiEnc.persistenceContextRefs.clear();
appInfo.appJndiEnc.persistenceUnitRefs.clear();
JndiEncInfo ejbEncInfo = new JndiEncInfo();
ejbEncInfo.ejbReferences.addAll(appInfo.globalJndiEnc.ejbReferences);
ejbEncInfo.ejbReferences.addAll(appInfo.appJndiEnc.ejbReferences);
ejbEncInfo.ejbReferences.addAll(moduleJndi.ejbReferences);
ejbEncInfo.ejbReferences.addAll(compJndi.ejbReferences);
ejbEncInfo.ejbLocalReferences.addAll(appInfo.globalJndiEnc.ejbLocalReferences);