【问题标题】:ActiveMQ jndi.properties java.naming.referralActiveMQ jndi.properties java.naming.referral
【发布时间】: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);

【问题讨论】:

    标签: java ldap jndi activemq


    【解决方案1】:

    是的,只需将 java.naming.referral=follow 放入名为 jndi.properties 的文本文件中,然后将其定位到 JAR 文件的根目录中。

    添加到 jar 文件:

    jar -uf run.jar jndi.properties

    【讨论】:

    • 我创建了 jndi.properties 并将其与 run.jar 一起放入 /bin 文件夹。它似乎没有接受这一点。有什么想法吗?
    • @Mark Brackett:不,把它放在 jar 文件中,在根目录下。
    猜你喜欢
    • 1970-01-01
    • 2011-02-26
    • 1970-01-01
    • 2011-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-20
    相关资源
    最近更新 更多