Program: 28257
Project: 28257
Buggy source:
/** 
 * Called from the ContainerFactory during initialization.
 */
protected void initializeHome() throws Exception {
  if (isWebServiceEndpoint) {
    EjbBundleDescriptorImpl bundle=ejbDescriptor.getEjbBundleDescriptor();
    WebServicesDescriptor webServices=bundle.getWebServices();
    Collection myEndpoints=webServices.getEndpointsImplementedBy(ejbDescriptor);
    Iterator iter=myEndpoints.iterator();
    webServiceEndpoint=(com.sun.enterprise.deployment.WebServiceEndpoint)iter.next();
    Class serviceEndpointIntfClass=loader.loadClass(webServiceEndpoint.getServiceEndpointInterface());
    if (!serviceEndpointIntfClass.isInterface()) {
      ServiceInterfaceGenerator generator=new ServiceInterfaceGenerator(loader,ejbClass);
      serviceEndpointIntfClass=EJBUtils.generateSEI(generator,generator.getGeneratedClass(),loader,this.ejbClass);
      if (serviceEndpointIntfClass == null) {
        throw new RuntimeException(localStrings.getLocalString("String_Node_Str","String_Node_Str",this.ejbClass));
      }
    }
    Class tieClass=null;
    WebServiceInvocationHandler invocationHandler=new WebServiceInvocationHandler(ejbClass,webServiceEndpoint,serviceEndpointIntfClass,ejbContainerUtilImpl,webServiceInvocationInfoMap);
    invocationHandler.setContainer(this);
    Object servant=(Object)Proxy.newProxyInstance(loader,new Class[]{serviceEndpointIntfClass},invocationHandler);
    if (webServiceEndpoint.getTieClassName() != null) {
      tieClass=loader.loadClass(webServiceEndpoint.getTieClassName());
    }
    EjbEndpointFacade endpointFacade=new EjbEndpointFacadeImpl(this,ejbContainerUtilImpl);
    wsejbEndpointRegistry=Globals.getDefaultHabitat().getService(WSEjbEndpointRegistry.class);
    if (wsejbEndpointRegistry != null) {
      wsejbEndpointRegistry.registerEndpoint(webServiceEndpoint,endpointFacade,servant,tieClass);
    }
 else {
      throw new DeploymentException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    }
  }
  Map<String,Object> intfsForPortableJndi=new HashMap<String,Object>();
  String javaGlobalName=getJavaGlobalJndiNamePrefix();
  if (isRemote) {
    boolean disableNonPortableJndiName=false;
    Boolean disableInDD=ejbDescriptor.getEjbBundleDescriptor().getDisableNonportableJndiNames();
    if (disableInDD != null) {
      disableNonPortableJndiName=disableInDD;
    }
 else {
      String disableInServer=ejbContainerUtilImpl.getEjbContainer().getPropertyValue(RuntimeTagNames.DISABLE_NONPORTABLE_JNDI_NAMES);
      disableNonPortableJndiName=Boolean.valueOf(disableInServer);
    }
    String glassfishSpecificJndiName=null;
    if (!disableNonPortableJndiName) {
      glassfishSpecificJndiName=ejbDescriptor.getJndiName();
      if ((glassfishSpecificJndiName != null) && (glassfishSpecificJndiName.equals("String_Node_Str") || glassfishSpecificJndiName.equals(javaGlobalName))) {
        glassfishSpecificJndiName=null;
      }
    }
    if (hasRemoteHomeView) {
      this.ejbHomeImpl=instantiateEJBHomeImpl();
      this.ejbHome=ejbHomeImpl.getEJBHome();
      ejbObjectProxyClass=Proxy.getProxyClass(loader,new Class[]{remoteIntf});
      ejbObjectProxyCtor=ejbObjectProxyClass.getConstructor(new Class[]{InvocationHandler.class});
      getProtocolManager().validateTargetObjectInterfaces(this.ejbHome);
      EJBObjectImpl dummyEJBObjectImpl=instantiateEJBObjectImpl();
      EJBObject dummyEJBObject=(EJBObject)dummyEJBObjectImpl.getEJBObject();
      getProtocolManager().validateTargetObjectInterfaces(dummyEJBObject);
      remoteHomeRefFactory.setRepositoryIds(homeIntf,remoteIntf);
      ejbHomeStub=(EJBHome)remoteHomeRefFactory.createHomeReference(homeInstanceKey);
      intfsForPortableJndi.put(ejbDescriptor.getHomeClassName(),ejbHomeStub);
      if (glassfishSpecificJndiName != null) {
        JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(glassfishSpecificJndiName,ejbHomeStub);
        jndiInfoMap.put(jndiInfo.name,jndiInfo);
      }
    }
    if (hasRemoteBusinessView) {
      this.ejbRemoteBusinessHomeImpl=instantiateEJBRemoteBusinessHomeImpl();
      this.ejbRemoteBusinessHome=ejbRemoteBusinessHomeImpl.getEJBHome();
      getProtocolManager().validateTargetObjectInterfaces(this.ejbRemoteBusinessHome);
      for (      RemoteBusinessIntfInfo next : remoteBusinessIntfInfo.values()) {
        next.proxyClass=Proxy.getProxyClass(loader,new Class[]{next.generatedRemoteIntf});
        next.proxyCtor=next.proxyClass.getConstructor(new Class[]{InvocationHandler.class});
        next.referenceFactory.setRepositoryIds(remoteBusinessHomeIntf,next.generatedRemoteIntf);
        if (ejbRemoteBusinessHomeStub == null) {
          ejbRemoteBusinessHomeStub=(EJBHome)next.referenceFactory.createHomeReference(homeInstanceKey);
        }
      }
      EJBObjectImpl dummyEJBObjectImpl=instantiateRemoteBusinessObjectImpl();
      String remoteBusinessHomeJndiName=null;
      if (glassfishSpecificJndiName != null) {
        remoteBusinessHomeJndiName=EJBUtils.getRemote30HomeJndiName(glassfishSpecificJndiName);
      }
      String simpleRemoteBusinessJndiName=null;
      if ((glassfishSpecificJndiName != null) && !hasRemoteHomeView && remoteBusinessIntfInfo.size() == 1) {
        simpleRemoteBusinessJndiName=glassfishSpecificJndiName;
      }
      String internalHomeJndiNameForPortableRemoteNames=EJBUtils.getRemote30HomeJndiName(javaGlobalName);
      for (      RemoteBusinessIntfInfo next : remoteBusinessIntfInfo.values()) {
        java.rmi.Remote dummyEJBObject=dummyEJBObjectImpl.getEJBObject(next.generatedRemoteIntf.getName());
        getProtocolManager().validateTargetObjectInterfaces(dummyEJBObject);
        if (glassfishSpecificJndiName != null) {
          next.jndiName=EJBUtils.getRemoteEjbJndiName(true,next.remoteBusinessIntf.getName(),glassfishSpecificJndiName);
          Reference remoteBusRef=new Reference(next.remoteBusinessIntf.getName(),new StringRefAddr("String_Node_Str",remoteBusinessHomeJndiName),"String_Node_Str",null);
          JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(next.jndiName,remoteBusRef);
          jndiInfoMap.put(jndiInfo.name,jndiInfo);
        }
        if (simpleRemoteBusinessJndiName != null) {
          Reference remoteBusRef=new Reference(next.remoteBusinessIntf.getName(),new StringRefAddr("String_Node_Str",remoteBusinessHomeJndiName),"String_Node_Str",null);
          JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(simpleRemoteBusinessJndiName,remoteBusRef);
          jndiInfoMap.put(jndiInfo.name,jndiInfo);
        }
        Reference remoteBusRef=new Reference(next.remoteBusinessIntf.getName(),new StringRefAddr("String_Node_Str",internalHomeJndiNameForPortableRemoteNames),"String_Node_Str",null);
        intfsForPortableJndi.put(next.remoteBusinessIntf.getName(),remoteBusRef);
      }
      if (remoteBusinessHomeJndiName != null) {
        JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(remoteBusinessHomeJndiName,ejbRemoteBusinessHomeStub);
        jndiInfo.setInternal(true);
        jndiInfoMap.put(jndiInfo.name,jndiInfo);
      }
      JndiInfo jndiInfo=JndiInfo.newPortableRemote(internalHomeJndiNameForPortableRemoteNames,ejbRemoteBusinessHomeStub);
      jndiInfo.setInternal(true);
      jndiInfoMap.put(jndiInfo.name,jndiInfo);
      if (glassfishSpecificJndiName == null) {
        ejbDescriptor.setJndiName(javaGlobalName);
      }
    }
  }
  if (isLocal) {
    if (hasLocalHomeView) {
      this.ejbLocalHomeImpl=instantiateEJBLocalHomeImpl();
      this.ejbLocalHome=ejbLocalHomeImpl.getEJBLocalHome();
      Class ejbLocalObjectProxyClass=Proxy.getProxyClass(loader,new Class[]{IndirectlySerializable.class,localIntf});
      ejbLocalObjectProxyCtor=ejbLocalObjectProxyClass.getConstructor(new Class[]{InvocationHandler.class});
      JavaGlobalJndiNamingObjectProxy namingProxy=new JavaGlobalJndiNamingObjectProxy(this,localHomeIntf.getName());
      intfsForPortableJndi.put(localHomeIntf.getName(),namingProxy);
    }
    if (hasLocalBusinessView) {
      ejbLocalBusinessHomeImpl=instantiateEJBLocalBusinessHomeImpl();
      ejbLocalBusinessHome=(GenericEJBLocalHome)ejbLocalBusinessHomeImpl.getEJBLocalHome();
      Class[] proxyInterfaces=new Class[localBusinessIntfs.size() + 1];
      proxyInterfaces[0]=IndirectlySerializable.class;
      int index=1;
      for (      Class next : localBusinessIntfs) {
        proxyInterfaces[index]=next;
        index++;
      }
      Class proxyClass=Proxy.getProxyClass(loader,proxyInterfaces);
      ejbLocalBusinessObjectProxyCtor=proxyClass.getConstructor(new Class[]{InvocationHandler.class});
      for (      Class next : localBusinessIntfs) {
        JavaGlobalJndiNamingObjectProxy namingProxy=new JavaGlobalJndiNamingObjectProxy(this,next.getName());
        intfsForPortableJndi.put(next.getName(),namingProxy);
      }
    }
    if (hasOptionalLocalBusinessView) {
      EJBLocalHomeImpl obj=instantiateEJBOptionalLocalBusinessHomeImpl();
      ejbOptionalLocalBusinessHomeImpl=(EJBLocalHomeImpl)obj;
      ejbOptionalLocalBusinessHome=(GenericEJBLocalHome)ejbOptionalLocalBusinessHomeImpl.getEJBLocalHome();
      Class[] proxyInterfaces=new Class[2];
      proxyInterfaces[0]=IndirectlySerializable.class;
      String optionalIntfName=EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
      proxyInterfaces[1]=ejbGeneratedOptionalLocalBusinessIntfClass=optIntfClassLoader.loadClass(optionalIntfName);
      Class proxyClass=Proxy.getProxyClass(loader,proxyInterfaces);
      ejbOptionalLocalBusinessObjectProxyCtor=proxyClass.getConstructor(new Class[]{InvocationHandler.class});
      JavaGlobalJndiNamingObjectProxy namingProxy=new JavaGlobalJndiNamingObjectProxy(this,ejbClass.getName());
      intfsForPortableJndi.put(ejbClass.getName(),namingProxy);
    }
  }
  for (  Map.Entry<String,Object> entry : intfsForPortableJndi.entrySet()) {
    String intf=entry.getKey();
    String fullyQualifiedJavaGlobalName=javaGlobalName + "String_Node_Str" + intf;
    Object namingProxy=entry.getValue();
    boolean local=(namingProxy instanceof JavaGlobalJndiNamingObjectProxy);
    if (intfsForPortableJndi.size() == 1) {
      JndiInfo jndiInfo=local ? JndiInfo.newPortableLocal(javaGlobalName,namingProxy) : JndiInfo.newPortableRemote(javaGlobalName,namingProxy);
      jndiInfoMap.put(jndiInfo.name,jndiInfo);
    }
    JndiInfo jndiInfo=local ? JndiInfo.newPortableLocal(fullyQualifiedJavaGlobalName,namingProxy) : JndiInfo.newPortableRemote(fullyQualifiedJavaGlobalName,namingProxy);
    jndiInfoMap.put(jndiInfo.name,jndiInfo);
  }
  for (  Map.Entry<String,JndiInfo> entry : jndiInfoMap.entrySet()) {
    JndiInfo jndiInfo=entry.getValue();
    try {
      jndiInfo.publish(this.namingManager);
      if (jndiInfo.internal) {
        publishedInternalGlobalJndiNames.add(jndiInfo.name);
      }
 else {
        if (jndiInfo.portable) {
          publishedPortableGlobalJndiNames.add(jndiInfo.name);
        }
 else {
          publishedNonPortableGlobalJndiNames.add(jndiInfo.name);
        }
      }
    }
 catch (    Exception e) {
      throw new RuntimeException(localStrings.getLocalString("String_Node_Str","String_Node_Str",jndiInfo.name,this.ejbDescriptor.getName()),e);
    }
  }
  if (!publishedPortableGlobalJndiNames.isEmpty()) {
    _logger.log(Level.INFO,"String_Node_Str",new Object[]{this.ejbDescriptor.getName(),publishedPortableGlobalJndiNames});
  }
  if (!publishedNonPortableGlobalJndiNames.isEmpty()) {
    _logger.log(Level.INFO,"String_Node_Str",new Object[]{this.ejbDescriptor.getName(),publishedNonPortableGlobalJndiNames});
  }
  if (!publishedInternalGlobalJndiNames.isEmpty()) {
    _logger.log(Level.FINE,"String_Node_Str",new Object[]{this.ejbDescriptor.getName(),publishedInternalGlobalJndiNames});
  }
  setEJBMetaData();
}

Fixed version (ground truth):
/** 
 * Called from the ContainerFactory during initialization.
 */
protected void initializeHome() throws Exception {
  if (isWebServiceEndpoint) {
    EjbBundleDescriptorImpl bundle=ejbDescriptor.getEjbBundleDescriptor();
    WebServicesDescriptor webServices=bundle.getWebServices();
    Collection myEndpoints=webServices.getEndpointsImplementedBy(ejbDescriptor);
    Iterator iter=myEndpoints.iterator();
    webServiceEndpoint=(com.sun.enterprise.deployment.WebServiceEndpoint)iter.next();
    Class serviceEndpointIntfClass=loader.loadClass(webServiceEndpoint.getServiceEndpointInterface());
    if (!serviceEndpointIntfClass.isInterface()) {
      ServiceInterfaceGenerator generator=new ServiceInterfaceGenerator(loader,ejbClass);
      serviceEndpointIntfClass=EJBUtils.generateSEI(generator,generator.getGeneratedClass(),loader,this.ejbClass);
      if (serviceEndpointIntfClass == null) {
        throw new RuntimeException(localStrings.getLocalString("String_Node_Str","String_Node_Str",this.ejbClass));
      }
    }
    Class tieClass=null;
    WebServiceInvocationHandler invocationHandler=new WebServiceInvocationHandler(ejbClass,webServiceEndpoint,serviceEndpointIntfClass,ejbContainerUtilImpl,webServiceInvocationInfoMap);
    invocationHandler.setContainer(this);
    Object servant=(Object)Proxy.newProxyInstance(loader,new Class[]{serviceEndpointIntfClass},invocationHandler);
    if (webServiceEndpoint.getTieClassName() != null) {
      tieClass=loader.loadClass(webServiceEndpoint.getTieClassName());
    }
    EjbEndpointFacade endpointFacade=new EjbEndpointFacadeImpl(this,ejbContainerUtilImpl);
    wsejbEndpointRegistry=Globals.getDefaultHabitat().getService(WSEjbEndpointRegistry.class);
    if (wsejbEndpointRegistry != null) {
      wsejbEndpointRegistry.registerEndpoint(webServiceEndpoint,endpointFacade,servant,tieClass);
    }
 else {
      throw new DeploymentException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    }
  }
  Map<String,Object> intfsForPortableJndi=new HashMap<String,Object>();
  String javaGlobalName=getJavaGlobalJndiNamePrefix();
  if (isRemote) {
    boolean disableNonPortableJndiName=false;
    Boolean disableInDD=ejbDescriptor.getEjbBundleDescriptor().getDisableNonportableJndiNames();
    if (disableInDD != null) {
      disableNonPortableJndiName=disableInDD;
    }
 else {
      String disableInServer=ejbContainerUtilImpl.getEjbContainer().getPropertyValue(RuntimeTagNames.DISABLE_NONPORTABLE_JNDI_NAMES);
      disableNonPortableJndiName=Boolean.valueOf(disableInServer);
    }
    String glassfishSpecificJndiName=null;
    if (!disableNonPortableJndiName) {
      glassfishSpecificJndiName=ejbDescriptor.getJndiName();
      if ((glassfishSpecificJndiName != null) && (glassfishSpecificJndiName.equals("String_Node_Str") || glassfishSpecificJndiName.equals(javaGlobalName))) {
        glassfishSpecificJndiName=null;
      }
    }
    if (hasRemoteHomeView) {
      this.ejbHomeImpl=instantiateEJBHomeImpl();
      this.ejbHome=ejbHomeImpl.getEJBHome();
      ejbObjectProxyClass=Proxy.getProxyClass(loader,new Class[]{remoteIntf});
      ejbObjectProxyCtor=ejbObjectProxyClass.getConstructor(new Class[]{InvocationHandler.class});
      getProtocolManager().validateTargetObjectInterfaces(this.ejbHome);
      EJBObjectImpl dummyEJBObjectImpl=instantiateEJBObjectImpl();
      EJBObject dummyEJBObject=(EJBObject)dummyEJBObjectImpl.getEJBObject();
      getProtocolManager().validateTargetObjectInterfaces(dummyEJBObject);
      remoteHomeRefFactory.setRepositoryIds(homeIntf,remoteIntf);
      ejbHomeStub=(EJBHome)remoteHomeRefFactory.createHomeReference(homeInstanceKey);
      intfsForPortableJndi.put(ejbDescriptor.getHomeClassName(),ejbHomeStub);
      if (glassfishSpecificJndiName != null) {
        JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(glassfishSpecificJndiName,ejbHomeStub);
        jndiInfoMap.put(jndiInfo.name,jndiInfo);
      }
    }
    if (hasRemoteBusinessView) {
      this.ejbRemoteBusinessHomeImpl=instantiateEJBRemoteBusinessHomeImpl();
      this.ejbRemoteBusinessHome=ejbRemoteBusinessHomeImpl.getEJBHome();
      getProtocolManager().validateTargetObjectInterfaces(this.ejbRemoteBusinessHome);
      for (      RemoteBusinessIntfInfo next : remoteBusinessIntfInfo.values()) {
        next.proxyClass=Proxy.getProxyClass(loader,new Class[]{next.generatedRemoteIntf});
        next.proxyCtor=next.proxyClass.getConstructor(new Class[]{InvocationHandler.class});
        next.referenceFactory.setRepositoryIds(remoteBusinessHomeIntf,next.generatedRemoteIntf);
        if (ejbRemoteBusinessHomeStub == null) {
          ejbRemoteBusinessHomeStub=(EJBHome)next.referenceFactory.createHomeReference(homeInstanceKey);
        }
      }
      EJBObjectImpl dummyEJBObjectImpl=instantiateRemoteBusinessObjectImpl();
      String remoteBusinessHomeJndiName=null;
      if (glassfishSpecificJndiName != null) {
        remoteBusinessHomeJndiName=EJBUtils.getRemote30HomeJndiName(glassfishSpecificJndiName);
      }
      String simpleRemoteBusinessJndiName=null;
      if ((glassfishSpecificJndiName != null) && !hasRemoteHomeView && remoteBusinessIntfInfo.size() == 1) {
        simpleRemoteBusinessJndiName=glassfishSpecificJndiName;
      }
      String internalHomeJndiNameForPortableRemoteNames=EJBUtils.getRemote30HomeJndiName(javaGlobalName);
      for (      RemoteBusinessIntfInfo next : remoteBusinessIntfInfo.values()) {
        java.rmi.Remote dummyEJBObject=dummyEJBObjectImpl.getEJBObject(next.generatedRemoteIntf.getName());
        getProtocolManager().validateTargetObjectInterfaces(dummyEJBObject);
        if (glassfishSpecificJndiName != null) {
          next.jndiName=EJBUtils.getRemoteEjbJndiName(true,next.remoteBusinessIntf.getName(),glassfishSpecificJndiName);
          Reference remoteBusRef=new Reference(next.remoteBusinessIntf.getName(),new StringRefAddr("String_Node_Str",remoteBusinessHomeJndiName),"String_Node_Str",null);
          JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(next.jndiName,remoteBusRef);
          jndiInfoMap.put(jndiInfo.name,jndiInfo);
        }
        if (simpleRemoteBusinessJndiName != null) {
          Reference remoteBusRef=new Reference(next.remoteBusinessIntf.getName(),new StringRefAddr("String_Node_Str",remoteBusinessHomeJndiName),"String_Node_Str",null);
          JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(simpleRemoteBusinessJndiName,remoteBusRef);
          jndiInfoMap.put(jndiInfo.name,jndiInfo);
        }
        Reference remoteBusRef=new Reference(next.remoteBusinessIntf.getName(),new StringRefAddr("String_Node_Str",internalHomeJndiNameForPortableRemoteNames),"String_Node_Str",null);
        intfsForPortableJndi.put(next.remoteBusinessIntf.getName(),remoteBusRef);
      }
      if (remoteBusinessHomeJndiName != null) {
        JndiInfo jndiInfo=JndiInfo.newNonPortableRemote(remoteBusinessHomeJndiName,ejbRemoteBusinessHomeStub);
        jndiInfo.setInternal(true);
        jndiInfoMap.put(jndiInfo.name,jndiInfo);
      }
      JndiInfo jndiInfo=JndiInfo.newPortableRemote(internalHomeJndiNameForPortableRemoteNames,ejbRemoteBusinessHomeStub);
      jndiInfo.setInternal(true);
      jndiInfoMap.put(jndiInfo.name,jndiInfo);
      if (glassfishSpecificJndiName == null) {
        ejbDescriptor.setJndiName(javaGlobalName);
      }
    }
  }
  if (isLocal) {
    if (hasLocalHomeView) {
      this.ejbLocalHomeImpl=instantiateEJBLocalHomeImpl();
      this.ejbLocalHome=ejbLocalHomeImpl.getEJBLocalHome();
      Class ejbLocalObjectProxyClass=Proxy.getProxyClass(loader,new Class[]{IndirectlySerializable.class,localIntf});
      ejbLocalObjectProxyCtor=ejbLocalObjectProxyClass.getConstructor(new Class[]{InvocationHandler.class});
      JavaGlobalJndiNamingObjectProxy namingProxy=new JavaGlobalJndiNamingObjectProxy(this,localHomeIntf.getName());
      intfsForPortableJndi.put(localHomeIntf.getName(),namingProxy);
    }
    if (hasLocalBusinessView) {
      ejbLocalBusinessHomeImpl=instantiateEJBLocalBusinessHomeImpl();
      ejbLocalBusinessHome=(GenericEJBLocalHome)ejbLocalBusinessHomeImpl.getEJBLocalHome();
      Class[] proxyInterfaces=new Class[localBusinessIntfs.size() + 1];
      proxyInterfaces[0]=IndirectlySerializable.class;
      int index=1;
      for (      Class next : localBusinessIntfs) {
        proxyInterfaces[index]=next;
        index++;
      }
      Class proxyClass=Proxy.getProxyClass(loader,proxyInterfaces);
      ejbLocalBusinessObjectProxyCtor=proxyClass.getConstructor(new Class[]{InvocationHandler.class});
      for (      Class next : localBusinessIntfs) {
        JavaGlobalJndiNamingObjectProxy namingProxy=new JavaGlobalJndiNamingObjectProxy(this,next.getName());
        intfsForPortableJndi.put(next.getName(),namingProxy);
      }
    }
    if (hasOptionalLocalBusinessView) {
      EJBLocalHomeImpl obj=instantiateEJBOptionalLocalBusinessHomeImpl();
      ejbOptionalLocalBusinessHomeImpl=(EJBLocalHomeImpl)obj;
      ejbOptionalLocalBusinessHome=(GenericEJBLocalHome)ejbOptionalLocalBusinessHomeImpl.getEJBLocalHome();
      Class[] proxyInterfaces=new Class[2];
      proxyInterfaces[0]=IndirectlySerializable.class;
      String optionalIntfName=EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
      proxyInterfaces[1]=ejbGeneratedOptionalLocalBusinessIntfClass=optIntfClassLoader.loadClass(optionalIntfName);
      Class proxyClass=Proxy.getProxyClass(loader,proxyInterfaces);
      ejbOptionalLocalBusinessObjectProxyCtor=proxyClass.getConstructor(new Class[]{InvocationHandler.class});
      JavaGlobalJndiNamingObjectProxy namingProxy=new JavaGlobalJndiNamingObjectProxy(this,ejbClass.getName());
      intfsForPortableJndi.put(ejbClass.getName(),namingProxy);
    }
  }
  for (  Map.Entry<String,Object> entry : intfsForPortableJndi.entrySet()) {
    String intf=entry.getKey();
    String fullyQualifiedJavaGlobalName=javaGlobalName + "String_Node_Str" + intf;
    Object namingProxy=entry.getValue();
    boolean local=(namingProxy instanceof JavaGlobalJndiNamingObjectProxy);
    if (intfsForPortableJndi.size() == 1) {
      JndiInfo jndiInfo=local ? JndiInfo.newPortableLocal(javaGlobalName,namingProxy) : JndiInfo.newPortableRemote(javaGlobalName,namingProxy);
      jndiInfoMap.put(jndiInfo.name,jndiInfo);
    }
    JndiInfo jndiInfo=local ? JndiInfo.newPortableLocal(fullyQualifiedJavaGlobalName,namingProxy) : JndiInfo.newPortableRemote(fullyQualifiedJavaGlobalName,namingProxy);
    jndiInfoMap.put(jndiInfo.name,jndiInfo);
  }
  for (  Map.Entry<String,JndiInfo> entry : jndiInfoMap.entrySet()) {
    JndiInfo jndiInfo=entry.getValue();
    try {
      jndiInfo.publish(this.namingManager);
      if (jndiInfo.internal) {
        publishedInternalGlobalJndiNames.add(jndiInfo.name);
      }
 else {
        if (jndiInfo.portable) {
          publishedPortableGlobalJndiNames.add(jndiInfo.name);
        }
 else {
          publishedNonPortableGlobalJndiNames.add(jndiInfo.name);
        }
      }
    }
 catch (    Exception e) {
      throw new RuntimeException(localStrings.getLocalString("String_Node_Str","String_Node_Str",jndiInfo.name,this.ejbDescriptor.getName()),e);
    }
  }
  if (!publishedPortableGlobalJndiNames.isEmpty()) {
    _logger.log(Level.INFO,PORTABLE_JNDI_NAMES,new Object[]{this.ejbDescriptor.getName(),publishedPortableGlobalJndiNames});
  }
  if (!publishedNonPortableGlobalJndiNames.isEmpty()) {
    _logger.log(Level.INFO,GLASSFISH_SPECIFIC_JNDI_NAMES,new Object[]{this.ejbDescriptor.getName(),publishedNonPortableGlobalJndiNames});
  }
  if (!publishedInternalGlobalJndiNames.isEmpty()) {
    _logger.log(Level.FINE,"String_Node_Str",new Object[]{this.ejbDescriptor.getName(),publishedInternalGlobalJndiNames});
  }
  setEJBMetaData();
}