On May 15, 2006, at 5:50 PM, Xia, Wen wrote:

I need to get some data from an LDAP directory. I tried to use the JNDI adaptor to create an EOModel for this data. I was successful in creating the model and browsing the data in EOModeler, but I was unable to use the model in any code to actually do anything useful. I kept getting error:

<WorkerThread5> java.lang.NullPointerException
at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch (LdapNamingEnumeration.java:110) at com.sun.jndi.ldap.LdapNamingEnumeration.nextAux (LdapNamingEnumeration.java:244) at com.sun.jndi.ldap.LdapNamingEnumeration.nextImpl (LdapNamingEnumeration.java:235)

I searched through the apple mailing list and its archive. I found some posts with the same problem, but I did not see a solution to it.

Looks like a modelling error.  LDAP models can be a bear to get right.

Also see
http://lists.apple.com/archives/Webobjects-dev/2005/Sep/msg00638.html
http://lists.apple.com/archives/Webobjects-dev/2005/Sep/msg00588.html

From the 5.1 Release Notes:
Reference       2753067
Problem The JNDI adaptor (with the LDAPPlugIn) sometimes throws a NullPointerException when fetching from a Netscape Directory Server. Description The problem has been observed on a Netscape Directory Server while searching an object class that has a large number of entries (on the order of thousands).There seems to be a problem with the LDAP Service Provider that Sun distributes. The LdapNamingEnumeration implementation of next() throws a NullPointerException in violation of the JNDI specification.The exception message follows:Exception in thread "main" java.lang.NullPointerException at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch (LdapNamingEnumeration.java:107) at com.sun.jndi.ldap.LdapNamingEnumeration.nextAux (LdapNamingEnumeration.java:180) at com.sun.jndi.ldap.LdapNamingEnumeration.next (LdapNamingEnumeration.java:171) ... etc.

Workaround Catch the exception and/or repeat the attempt to fetch. The problem seems to occur frequently but somewhat irregularly.



From the limited documentation I could find, it looks like a JNDI model should work just like a JDBC model. Is anyone successfully using the JNDI adaptor to fetch LDAP data using EOModel? If so, what is the trick in getting it to work?


If all else fails,
Another alternative to using an EOModel to interact with an LDAP type store is to use Novell's Directory Services code. The Novel code is open sourced and provides all of the features and functionality to read and write to X.500 stores. It even supports SSL, Kerberos, and some other authentication services. The Novell code can be found at http:// developer.novell.com/ndk/jldap.htm

It says Netware and Windows but it runs just fine on OSX, and Linux.

-- Dov Rosenberg

Chuck

--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to