Two Laptop Bag*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes jndi hell !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "jndi hell !!" Watch "jndi hell !!" New topic
Author

jndi hell !!

Ankur Jain
Ranch Hand

Joined: Sep 02, 2003
Posts: 44
just can't make it work.
i've added this code to AdviceClient.java

but now its giving these error messages
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:171)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290)
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:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at AdviceClient.go(AdviceClient.java:19)
at AdviceClient.main(AdviceClient.java:9)

I'm using Sun App Server v8
my jndi.properties file looks like this :
java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming


Is the code for context.PROVIDER_URL field.(above) correct?
Please help me as I'm stuck with it for 4 days.
regards
ankur


Ankur<br />SCJP,SCBCD
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Ankur,

Why are you using ldap to connect to the app server's naming context

I think this is the actual problem. You're using an overloaded InitialContext constructor (with Hashtable argument) and therefore, jndi.properties is never used (it gets used when no-arg InitialContext constructor is invoked).

You could still use an overloaded constructor of InitialContext provided that you populate Hashtable argument with the correct entries rather than with the ldap related ones

Hope it makes sense
[ June 16, 2004: Message edited by: Alex Sharkoff ]

Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
 
 
subject: jndi hell !!
 
Similar Threads
Connection To Active Directory Error
LDAP server Access Error in java
cannot connect to LDAP through JNDI
Attemplting to connect to a public LDAP directory
Error Using Ldap