File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Error Using Ldap

hk doley
Greenhorn

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

Joined: Feb 05, 2001
Posts: 17250
    
    6

"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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error Using Ldap