关于keystore问题
代码如下红色部分是静态的,每次证书更改后都要重启服务,请问,怎么把它变成动态的,也就是证书更改后不用重启服务的那种:
/**
* 证书连接WIN AD
* @throws Exception
*/
public void connectionWithCert() throws Exception {
System.setProperty ("javax.net.ssl.trustStore",this.keyStorePath);
Properties env = null;
TestResult tr = null;
try {
tr = new TestResult(TestTypes.CONNADCERT);
env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, SUN_JNDI_PROVIDER);// java.naming.factory.initial
env.put(Context.PROVIDER_URL, "ldaps://"+props.getProperty("ip")+":"+636);
env.put(Context.SECURITY_AUTHENTICATION, "simple");// java.naming.security.authentication
env.put(Context.SECURITY_PRINCIPAL,props.getProperty("userDn"));// java.naming.security.principal
env.put(Context.SECURITY_CREDENTIALS, props.getProperty("password"));// java.naming.security.credentials
env.put(Context.SECURITY_PROTOCOL, "ssl");
tr.setMsg("证书连接WinAD,ip:"+props.getProperty("ip")+",用户名:"+props.getProperty("userDn"));
ctxWithCert = new InitialLdapContext(env, null);
tr.setStateTrue();
} catch (Exception e) {
tr.setMsg(e.getMessage());
e.printStackTrace();
throw e;
}finally{
trmaps.put(TestTypes.CONNADCERT, tr);
}
}