【发布时间】:2011-04-18 22:13:06
【问题描述】:
ActiveMQ 的LDAPLoginModule 在搜索 LDAP 树的根目录时不喜欢我的 AD 服务器生成的 LDAP searchResRef。它生成(吞下):
NamingException javax.naming.PartialResultException:未处理的继续引用;
我需要将java.naming.referral 属性设置为follow。我可以通过添加来更改来源:
env.put(Context.REFERRAL, "关注");
但是,有没有办法使用神秘的(对我的 C# 大脑而言)jndi.properties 文件来避免重新编译?
更多信息
用于启动进程的命令行:
/usr/bin/java -Xms256M -Xmx256M
-Dorg.apache.activemq.UseDedicatedTaskRunner=true
-Djava.util.logging.config.file=logging.properties
-Djava.security.auth.login.config=/root/apache-activemq-5.5.0/conf/login.config
-Dcom.sun.management.jmxremote
-Dactivemq.classpath=/root/apache-activemq-5.5.0/conf;
-Dactivemq.home=/root/apache-activemq-5.5.0
-Dactivemq.base=/root/apache-activemq-5.5.0
-jar /root/apache-activemq-5.5.0/bin/run.jar start
我想要影响的现有代码位(isLoginPropertySet 和 getLDAPPropertyValue 只是从 ActiveMQ 配置文件中读取 - 上面命令行中的 login.config):
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, getLDAPPropertyValue(INITIAL_CONTEXT_FACTORY));
if (isLoginPropertySet(CONNECTION_USERNAME)) {
env.put(Context.SECURITY_PRINCIPAL, getLDAPPropertyValue(CONNECTION_USERNAME));
}
if (isLoginPropertySet(CONNECTION_PASSWORD)) {
env.put(Context.SECURITY_CREDENTIALS, getLDAPPropertyValue(CONNECTION_PASSWORD));
}
env.put(Context.SECURITY_PROTOCOL, getLDAPPropertyValue(CONNECTION_PROTOCOL));
env.put(Context.PROVIDER_URL, getLDAPPropertyValue(CONNECTION_URL));
env.put(Context.SECURITY_AUTHENTICATION, getLDAPPropertyValue(AUTHENTICATION));
context = new InitialDirContext(env);
【问题讨论】: