File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Error Using Ldap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Error Using Ldap" Watch "Error Using Ldap" New topic

Error Using Ldap

hk doley

Joined: Feb 03, 2006
Posts: 1
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

Joined: Feb 05, 2001
Posts: 17276

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!


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Error Using Ldap
It's not a secret anymore!