This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "apply not implemented for PrimProcedure" while attempting to use JNDI


Valtteri Vuorikoski <vuori@puuhamaa.magenta.net> writes:

> Thanks, that seems to fix it. I'll have to continue messing with JNDI at
> work later today (with a populated LDAP server nearby) and see how that turns
> out (-:

To reply to myself, I got somewhat further now but ran into another
same kind-ish exception. Invoking any of answer's methods (ie. next)
seems to lead to the following RuntimeException (getting there
probably requires some sort of running LDAP server or use of another
context factory).

#|kawa:1|# (define env (make <java.util.Hashtable>))
#|kawa:2|# (require <javax.naming.Context>)
#|kawa:21|# (invoke env 'put INITIAL_CONTEXT_FACTORY 'com.sun.jndi.ldap.LdapCtxFactory)
#!null
#|kawa:34|# (invoke env 'put PROVIDER_URL (as <String> "ldap://server:389";))
#!null
#|kawa:38|# (define dctx (make <javax.naming.directory.InitialDirContext> env))
#|kawa:42|# dctx
javax.naming.directory.InitialDirContext@4b754f
#|kawa:48|# (define attr (make <javax.naming.directory.BasicAttributes> #t))
#|kawa:55|# (invoke attr 'put (make <javax.naming.directory.BasicAttribute> 'uid "vuori"))
#!null
#|kawa:57|# attr
{uid=uid: vuori}
#|kawa:58|# (define answer (invoke dctx 'search "ou=people, dc=magenta, dc=net" attr))
#|kawa:59|# answer
com.sun.jndi.ldap.LdapSearchEnumeration@7ba502
#|kawa:60|# (invoke answer 'has-more)
java.lang.RuntimeException: apply not implemented for PrimProcedure java.lang.Object com.sun.jndi.ldap.LdapNamingEnumeration.next() - java.lang.IllegalAccessException
	at gnu.expr.PrimProcedure.applyV(PrimProcedure.java:157)
	at gnu.mapping.MethodProc.applyN(MethodProc.java:115)
	at gnu.kawa.reflect.Invoke.applyN(Invoke.java:148)
	at gnu.kawa.reflect.Invoke.applyN(Invoke.java:49)
	at gnu.mapping.Procedure.apply(Procedure.java:102)
	at gnu.mapping.CallContext.run(CallContext.java:183)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:184)
	at kawa.Shell.run(Shell.java:77)
	at kawa.Shell.run(Shell.java:32)
	at kawa.repl.apply0(repl.java:27)
	at gnu.mapping.Future.run(Future.java:59)

LdapSearchEnumeration is an implementation of javax.naming.NamingEnumeration.
The search above should return some results. I didn't try with one that doesn't
(somewhat busy today unfortunately). Javadoc only lists one kind of next()
for NamingEnumeration (Object next()).

 -valtteri


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]