Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Using Ldap

hk doley
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was successfully able to connect to my jndi resources through File System based protocol using com.sun.jndi.fscontext.RefFSContextFactory. But when I am trying to access the same using ldap it is giving me the following error.


javax.naming.CommunicationException: Request: 1 cancelled
at com.sun.jndi.ldap.LdapRequest.getReplyBer(
at com.sun.jndi.ldap.Connection.readReply(
at com.sun.jndi.ldap.LdapClient.ldapBind(
at com.sun.jndi.ldap.LdapClient.authenticate(
at com.sun.jndi.ldap.LdapCtx.connect(
at com.sun.jndi.ldap.LdapCtx.<init>(
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.InitialContext.<init>(
at QueueWriter.initialize(

This is the code

Context ctx = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:7676");
env.put( Context.SECURITY_PRINCIPAL, "guest" );
env.put( Context.SECURITY_CREDENTIALS, "guest" );
ctx = new InitialContext(env);
qcf = (com.sun.messaging.QueueConnectionFactory) ctx.lookup(m_strQueueConFacLookupName);
catch (NamingException ne)

Could anyone help me in the following :

1. Do I need to change any settings in Sun Java Application Server for using LDAP?
2. What other options do I have to connect to my jndi resources other than File System based protocol?

I am running these in SUN JAVA Application Server 8 running in a solaris x86 platform ( Dont ask me why !!)

"Code UnCode"
Mark Spritzler
Posts: 17278
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it


Thanks! and welcome to the JavaRanch!

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic