title: ActiveMQ jndi.properties java.naming.referral
body: <p>ActiveMQ's <a href="http://svn.apache.org/viewvc/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java?revision=1069405&amp;view=co" rel="nofollow">LDAPLoginModule</a> doesn't like the LDAP searchResRef generated by my AD server when searching the root of the LDAP tree. It generates (a swallowed):</p>
  
  <blockquote>
    <p>NamingException javax.naming.PartialResultException: Unprocessed Continuation Reference(s);</p>
  </blockquote>
  
  <p>I need to set the <code>java.naming.referral</code> property to <code>follow</code>. I can change the source by adding:</p>
  
  <blockquote>
    <p>env.put(Context.REFERRAL, "follow");</p>
  </blockquote>
  
  <p>But, is there a way to use the mystical (to my C# brain) <a href="http://download.oracle.com/javase/jndi/tutorial/beyond/env/source.html" rel="nofollow">jndi.properties</a> file to avoid a recompile? </p>
  
  <h2>More Info</h2>
  
  <p>The command line used to start the process:</p>
  
  <pre><code>/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
  </code></pre>
  
  <p>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):</p>
  
  <pre><code>Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;();
  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);
  </code></pre>