You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2016/01/05 18:53:39 UTC

[jira] [Commented] (DIRSERVER-2110) org.apache.directory.shared.ldap.codec.BasicControlDecorator cannot be cast to org.apache.directory.shared.ldap.model.message.controls.PersistentSearch

    [ https://issues.apache.org/jira/browse/DIRSERVER-2110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15083457#comment-15083457 ] 

Emmanuel Lecharny commented on DIRSERVER-2110:
----------------------------------------------

Here, there is a conflict between JNDI and the Apache LDAP API. I don't know why both are used, but this is the cause of yoru problem.

Basically, something is trying to cast a JNDI Control to a Apache LDAP API PersistentSearch control. We need the code that does this cast to know what's wrong and how to fix it.

> org.apache.directory.shared.ldap.codec.BasicControlDecorator cannot be cast to org.apache.directory.shared.ldap.model.message.controls.PersistentSearch
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-2110
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-2110
>             Project: Directory ApacheDS
>          Issue Type: Bug
>    Affects Versions: 2.0.0-M6
>            Reporter: Charles Moulliard
>
> I have created a standalone Apache DS Server (version 2.0.0-m6) which is working fine
> https://gist.github.com/cmoulliard/fbbdb7521104f3f23c27
> but when a LDAP client (developed inside a class of Apache ActiveMQ project - ) is doing some requests on the DirContext I get such class cast exception
> {code}
> Query code 
>    protected void query() throws Exception {
>         DirContext currentContext = open();
>         final SearchControls constraints = new SearchControls();
>         constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
>         DefaultAuthorizationMap newMap = new DefaultAuthorizationMap();
>         for (PermissionType permissionType : PermissionType.values()) {
>             try {
>                 processQueryResults(newMap,
>                     currentContext.search(queueSearchBase, getFilterForPermissionType(permissionType),
>                     constraints), DestinationType.QUEUE, permissionType);
>             } catch (Exception e) {
>                 LOG.error("Policy not applied!.  Error processing policy under '{}' with filter '{}'", new Object[]{ queueSearchBase, getFilterForPermissionType(permissionType) }, e);
>             }
>         }
> {code}
> Error
> {code}
> Thread-15 ERROR [org.apache.activemq.security.SimpleCachedLDAPAuthorizationMap] - Caught unexpected exception.
> javax.naming.NamingException: [LDAP: error code 80 - OTHER: failed for MessageType : SEARCH_REQUEST
> Message ID : 11
>     SearchRequest
>         baseDn : 'ou=Temp,ou=Destination,ou=ActiveMQ,ou=system'
>         filter : '(cn=read)'
>         scope : whole subtree
>         typesOnly : false
>         Size Limit : no limit
>         Time Limit : no limit
>         Deref Aliases : deref Always
>         attributes : 
> org.apache.directory.shared.ldap.model.message.SearchRequestImpl@291cd875    OpaqueControl Control
>         Type OID    : '2.16.840.1.113730.3.4.3'
>         Criticality : 'true'
> '
>     OpaqueControl Control
>         Type OID    : '2.16.840.1.113730.3.4.2'
>         Criticality : 'false'
> '
> : org.apache.directory.shared.ldap.codec.BasicControlDecorator cannot be cast to org.apache.directory.shared.ldap.model.message.controls.PersistentSearch]; remaining name 'ou=Temp,ou=Destination,ou=ActiveMQ,ou=system'
>         at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3179)
>         at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3081)
>         at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2888)
>         at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.getNextBatch(AbstractLdapNamingEnumeration.java:148)
>         at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:217)
>         at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnumeration.java:189)
>         at com.sun.jndi.ldap.NamingEventNotifier.run(NamingEventNotifier.java:135)
>         at java.lang.Thread.run(Thread.java:745)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)