By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,797 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,797 IT Pros & Developers. It's quick & easy.

configure JNDI properties for LDAP server

P: 30
I have a problem in configuring JNDI properties for LDAP server

i created jndi.properties file in the current directory where i'm running a simple java code.

jndi.properties file which i created consists the following:
java.naming.factory.initial=com.sun.jndi.ldap.Ldap CtxFactory
java.naming.provider.url=ldap://localhost:389

and i'm using j2eeRI 1.3 to run the following code:
filename : JNDILookupAny.java
----------------------------------------------------------------------------------------------
import javax.naming.*;

public class JNDILookupAny
{
public static void main(String args[])
{
try{
if(args.length!=1)
{
System.err.println("Usage : JNDILookupAny JNDIName");
System.exit(1);
}
Context ic = new InitialContext();
Object o = ic.lookup(args[0]);
System.out.println(args[0]+" = "+o);
}
catch(NamingException ne)
{
System.err.println(ne);
System.exit(1);
}
catch(ClassCastException cc)
{
System.err.println(cc);
System.exit(1);
}

}
}
----------------------------------------------------------------------------------------------
I got a CommunicationException:connection refused ... i tried changing port but the problem remains same.

help me!!!!!!!!!!!!!!!!!!!!!!!!1
Dec 7 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.