我正在尝试将 ObjectChangeListener 与 openldap 连接一起使用。我有以下java代码
public class MyListener implements ObjectChangeListener
{
// Here my class variable
public MyListener (DirContext ldapContext, String myDn) throws InternalException
{
try
{
// Make a new connection without pooling
Hashtable env = new Hashtable(ldapContext.getEnvironment());
// env is set by other classes : in our case we use the factory java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
InitialDirContext localContext = new InitialDirContext(env);
// Get the EventContext for registering the listener
evtCtx = (EventContext) localContext.lookup("");
localContext.close();
// Register the listener for namespace change events
evtCtx.addNamingListener(myDn, EventContext.OBJECT_SCOPE, this);
}
catch (NamingException e)
{
throw new InternalException("Error while registering my listener");
}
}
//some methods
}
当我创建一个新的 MyListenerObject 时,我的 openLdap 服务器发送了以下错误。
javax.naming.OperationNotSupportedException:[LDAP:错误代码 12 - 无法识别关键扩展];剩余名称 'ou=MyOU,O=MyOrg'
我不知道我需要做什么(或者如果可能的话)来创建一个带有 OpenLdap 的 ObjectListener。
谢谢