IPublisherSessionLocalHome pubHome = (IPublisherSessionLocalHome)publishers.get(publisherid);
IPublisherSessionLocalHome pubHome = (IPublisherSessionLocalHome)publishers.get(publisherid-1);
    public X509CRL createCRL(Admin admin, int caid, Vector certs) {        debug(">createCRL()");        X509CRL crl = null;        try {          // get CA          CADataLocal cadata = null;           try{             cadata = cadatahome.findByPrimaryKey(new Integer(caid));          }catch(javax.ejb.FinderException fe){             getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(),null, null, LogEntry.EVENT_ERROR_CREATECRL,"Invalid CA Id",fe);               throw new EJBException(fe);                             }                          CA ca = null;          try{            ca = cadata.getCA();          }catch(java.io.UnsupportedEncodingException uee){            throw new EJBException(uee);             }		  if(ca.getStatus() != SecConst.CA_ACTIVE){			getLogSession().log(admin, caid, LogEntry.MODULE_CA,  new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECERTIFICATE,"Signing CA " + cadata.getSubjectDN() + " isn't active.");			throw new EJBException("Signing CA " + cadata.getSubjectDN() + " isn't active.");             		  }                          // Check that CA hasn't expired.          X509Certificate cacert = (X509Certificate) ca.getCACertificate();                            try{            cacert.checkValidity();                             }catch(CertificateExpiredException e){            // Signers Certificate has expired.               cadata.setStatus(SecConst.CA_EXPIRED);              getLogSession().log(admin, caid, LogEntry.MODULE_CA,  new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL,"Signing CA " + cadata.getSubjectDN() + " has expired",e);            throw new EJBException("Signing CA " + cadata.getSubjectDN() + " has expired");             }catch(CertificateNotYetValidException e){          	 throw new EJBException(e);                       }                              ICertificateStoreSessionLocal certificateStore = storeHome.create();           // Get number of last CRL and increase by 1          int number = certificateStore.getLastCRLNumber(admin, ca.getSubjectDN()) + 1;          crl = (X509CRL) ca.generateCRL(certs, number);                              getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(),null, null, LogEntry.EVENT_INFO_CREATECRL,"Number :" + number);                    // Store CRL in the database          String fingerprint = CertTools.getFingerprintAsString(cacert);          certificateStore.storeCRL(admin, crl.getEncoded(), fingerprint, number);          // Store crl in ca CRL publishers.          Iterator iter = ca.getCRLPublishers().iterator();          while(iter.hasNext()){            int publisherid = ((Integer) iter.next()).intValue();            IPublisherSessionLocalHome pubHome = (IPublisherSessionLocalHome)publishers.get(publisherid);            IPublisherSessionLocal pub = pubHome.create();            pub.storeCRL(admin, crl.getEncoded(), fingerprint, number);                       }        } catch (Exception e) {                      getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(),null, null, LogEntry.EVENT_ERROR_CREATECRL,"");                      throw new EJBException(e);        }        debug("<createCRL()");        return crl;    } // createCRL