IPublisherSessionLocalHome pubHome = (IPublisherSessionLocalHome)publishers.get(publisherid);
IPublisherSessionLocalHome pubHome = (IPublisherSessionLocalHome)publishers.get(publisherid-1);
   public void publishCACertificate(Admin admin, Collection certificatechain, Collection usedpublishers, int certtype){       try{                            ICertificateStoreSessionLocal certificateStore = storeHome.create();                 Iterator certificates = certificatechain.iterator();           while(certificates.hasNext()){               Certificate cacert = (Certificate) certificates.next();                           //     Store CA certificate in the database                String fingerprint = CertTools.getFingerprintAsString((X509Certificate) cacert);                           if(certificateStore.findCertificateByFingerprint(admin, fingerprint) == null){                                                    certificateStore.storeCertificate(admin, cacert, "SYSTEMCA", fingerprint, CertificateData.CERT_ACTIVE, certtype);                }                  // Store cert in ca cert publishers.                Iterator iter = usedpublishers.iterator();                while(iter.hasNext()){                    int publisherid = ((Integer) iter.next()).intValue();                     debug("Storing certificate in publisher: "+publisherid);                                                         // Store CA certificate                    IPublisherSessionLocalHome pubHome = (IPublisherSessionLocalHome)publishers.get(publisherid);                    IPublisherSessionLocal pub = pubHome.create();                    pub.storeCertificate(admin, cacert, fingerprint, fingerprint, CertificateData.CERT_ACTIVE, certtype);                            }        }       }catch(javax.ejb.CreateException ce){           throw new EJBException(ce);          }   }