Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

LDAP and EJBs  RSS feed

 
Joseph Rank
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to Mike Curwen for the solution to my previous post (2nd suggestion worked).
Now that everything is running, though, I've uncovered what I fear will be a much thornier issue. My stateless session EJB instantiates a helper class to do an LDAP read. The helper class successfully connects to the LDAP from the command line, but the LDAP returns an error 52 (DSA unavailable) when the same code is executed in the ejb container. (I'm using J2EE 1.2.1 on Solaris 2.6.) The helper class is using the Netscape Java LDAP SDK. Should I be using JNDI instead? Is there some resource I'm not providing during the EJB packaging? I don't expect a flood of replies :-), but if anyone has any suggestions, I'm sure ripe to entertain them.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad I could help you out.

The thing is... from a command line your helper class can access LDAP because it does not have a 'neighbourhood bully' in it's way. Otherwise known as "the container", this bully may be getting in the way of your LDAP lookups when you run the helper class within the confines of a J2EE app.

I think you'll need to use JNDI, but not in a bad way. If you can get an 'LDAP Service Provider', then you are set. You simply specify a JNDI name for your LDAP directory in the 'Resource References' part of your app. (The reference implementation deploytool has 3 types of providers - a datasource, a JavaMail, and a URL provider). I think you would need an LDAP provider in this list...

Beyond that, I'm not sure where to find this provider or how to use it, or even if you can get the deploytool to recognize your new provider.

I am speculating for this entire post, by the way, but I did do a little reading on it. Ed Roman's book has a good section on this (Appendix B). I'd suggest snagging a copy in a bookstore or library and giving that appendix a quick glance. It's called: "Mastering Enterprise JavaBeans - and the Java 2 Platform, Enterprise Edition" by Ed Roman.

It talks a lot about older specs of EJB (1.0), but it also has good general information.

I just saw this post as well: http://www.javaranch.com/ubb/Forum11/HTML/000982.html
[This message has been edited by Mike Curwen (edited June 08, 2001).]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've looked into this a bit more... I found this article, but I've only skimmed it. About half way down it refers to LDAP and JNDI integration. http://www.javaworld.com/javaworld/jw-10-2000/jw-1027-pool.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!