ActiveMQ's LDAPLoginModule doesn't like the LDAP searchResRef generated by my AD server when searching the root of the LDAP tree. It generates (a swallowed):
NamingException javax.naming.PartialResultException: Unprocessed Continuation Reference(s);
I need to set the java.naming.referral
property to follow
. I can change the source by adding:
env.put(Context.REFERRAL, "follow");
But, is there a way to use the mystical (to my C# brain) jndi.properties file to avoid a recompile?
The command line used to start the process:
/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
The bit of existing code I want to influence (isLoginPropertySet and getLDAPPropertyValue just read from an ActiveMQ config file - login.config in the above commandline):
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);
Yes, just put java.naming.referral=follow
into a text file named jndi.properties
and locate that in the root directory of your JAR file.
To add to a jar file:
jar -uf run.jar jndi.properties