2012-09-12 80 views
0

我正嘗試使用帶有openldap連接的ObjectChangeListener。 我已經得到了下面的Java代碼如何使用OpenLdap創建ObjectChangeListener

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。

Thx

回答

0

你不能。截至當前版本(2.4)OpenLDAP不支持它。