debug("Error retrieving the home of  CertificateData or CRLData."); exc.printStackTrace();
error("Error retrieving the home of CertificateData or CRLData.", exc);
    public boolean storeCRL(Admin admin, byte[] incrl, String cafp, int number)        throws RemoteException {        X509CRL crl = null;        String dn = null;        String cn = null;        try {            crl = CertTools.getCRLfromByteArray(incrl);            // Extract the users DN from the crl.            dn = CertTools.getIssuerDN(crl);            cn = CertTools.getPartFromDN(dn, "CN");        } catch (Exception e) {            debug("Error decoding input CRL: ", e);            try {                logsession.log(admin, LogEntry.MODULE_CA, new java.util.Date(), null, null,                    LogEntry.EVENT_ERROR_STORECRL, "Error decoding input CRL.");            } catch (RemoteException re) {            }            return false;        }        //We don't check the ContainerName for Active Directory, so comment it out        //The reason is ,CertTools.stringToBcX509Name() can't deal with Active Directory Name.        //if (checkContainerName(dn) == false)        //  return false;        Hashtable env = new Hashtable();        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.jndi.LDAPCtxFactory");        env.put(Context.SECURITY_PRINCIPAL, loginDN);        env.put(Context.SECURITY_CREDENTIALS, loginPassword);        env.put(Context.SECURITY_AUTHENTICATION, "simple");        env.put(Context.PROVIDER_URL, "ldap://" + ldapHost + ":" + ldapPort + "/" + containerName);        try {            // Create the initial directory context            DirContext ctx = new InitialDirContext(env);            // Ask for all attributes of the object            //oldEntry = ctx.getAttributes("CN=" + cn);            //Destroy old entry if exists, Active Directory doesn't allow modification.            ctx.destroySubcontext("CN=" + cn);            ctx.close();        } catch (NamingException e) {        }        try {            // Create the initial directory context            DirContext ctx = new InitialDirContext(env);            // Create a new attribute set for the entry.            BasicAttributes attrs = new BasicAttributes();            BasicAttribute ocs = new BasicAttribute("objectclass");            ocs.add("top");            ocs.add(cAObjectclass);            attrs.put(ocs);            //Must set the cACertificate attribute for Active Directory, so retrieve from RSASignSession bean.            ISignSessionHome signHome = null;            try {                InitialContext stctx = new InitialContext();                signHome = (ISignSessionHome) javax.rmi.PortableRemoteObject.narrow(stctx.lookup(                            "se/anatom/ejbca/ca/sign/ISignSessionRemote"), ISignSessionHome.class);            } catch (NamingException exc) {                debug("Error retrieving the home of  CertificateData or CRLData.");                exc.printStackTrace();                return false;            }            ISignSessionRemote rsasign = signHome.create();            Certificate[] certchain = rsasign.getCertificateChain(new Admin(Admin.TYPE_INTERNALUSER));            //Use CA's certificate.            attrs.put(new BasicAttribute("cACertificate;binary", certchain[0].getEncoded()));            attrs.put(new BasicAttribute("certificateRevocationList;binary", incrl));            attrs.put(new BasicAttribute("authorityRevocationList;binary", incrl));            // Create an entry with this DN and these attributes .            ctx.createSubcontext("CN=" + cn, attrs);            ctx.close();            return true;        } catch (Exception e) {            debug("Error storing CRL in Active Directory LDAP: ", e);            try {                logsession.log(admin, LogEntry.MODULE_CA, new java.util.Date(), null, null,                    LogEntry.EVENT_ERROR_STORECRL, "Error storing CRL in Active Directory LDAP.");            } catch (RemoteException re) {            }        }        return false;    }