Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Using Ldap

 
hk doley
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.

STACK TRACE -

javax.naming.CommunicationException: Request: 1 cancelled
at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60)
at com.sun.jndi.ldap.Connection.readReply(Connection.java:405)
at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:192)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2637)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:283)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at QueueWriter.initialize(QueueWriter.java:63)


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_AUTHENTICATION,"simple");
env.put( Context.SECURITY_PRINCIPAL, "guest" );
env.put( Context.SECURITY_CREDENTIALS, "guest" );
try
{
ctx = new InitialContext(env);
qcf = (com.sun.messaging.QueueConnectionFactory) ctx.lookup(m_strQueueConFacLookupName);
}
catch (NamingException ne)
{
ne.printStackTrace();
}



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 !!)

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

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic