directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Kaiser" <carsten.kai...@valtech.de>
Subject [ApacheDS] Embedded: Cannot create subcontext beneath newly created sub context()...
Date Mon, 09 Aug 2010 13:23:55 GMT
Hello there,

I'am a newbie to LDAP  and I'm trying to use ApacheDS as embedded 
LDAPServer for our integration tests. It took my quite some time to figure 
out, how to get the web application up and running, to add my custom 
schema extensions and to load my setup data. I'm using version 1.5.5 since 
the example code for 1.5.7 was broken and I did not want to spend much 
more time in getting 1.5.8-SNAPSHOT working. The schema extensions and the 
setup data is loaded into the system partition resp. others partition 
since I'm trying to simulate the later production environment, which will 
use Sun ONE, so I want to use the schema as it will be defined in there.

Now I'am able to query my data and even to add new entries, but 
unfortunately I'm not able to add another entry below my newly created 
entries due to following error

15:06:02 [http-8088-1     ] ERROR de.aaa.AAARegistry 
(552) - [LDAP: error code 32 - NO_SUCH_OBJECT: failed for 
SearchRequest
        baseDn : '1.3.6.1.4.1.36200.255.0.7='
        filter : '(2.5.4.0=*)'
        scope : base object
        typesOnly : false
        Size Limit : no limit
        Time Limit : no limit
        Deref Aliases : deref Always
        attributes :
:  Cannot find a partition for 1.3.6.1.4.1.36200.255.0.7=]
javax.naming.NameNotFoundException: [LDAP: error code 32 - NO_SUCH_OBJECT: 
failed for     SearchRequest
        baseDn : '1.3.6.1.4.1.36200.255.0.7='
        filter : '(2.5.4.0=*)'
        scope : base object
        typesOnly : false
        Size Limit : no limit
        Time Limit : no limit
        Deref Aliases : deref Always
        attributes :
:  Cannot find a partition for 1.3.6.1.4.1.36200.255.0.7=]; remaining name 
'servicename=/devices/v1/, 
vin=WVWZZZ1JZXW000002,ou=devices,c=DE,o=Branch,o=AAA,ou=system'
	at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3066)
	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2987)
	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2794)
	at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:1011)
	at 
com.sun.jndi.toolkit.ctx.ComponentContext.c_resolveIntermediate_nns(ComponentContext.java:152)
	at 
com.sun.jndi.toolkit.ctx.AtomicContext.c_resolveIntermediate_nns(AtomicContext.java:342)
	at 
com.sun.jndi.toolkit.ctx.ComponentContext.p_resolveIntermediate(ComponentContext.java:381)
	at 
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_createSubcontext(ComponentDirContext.java:311)
	at 
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(PartialCompositeDirContext.java:248)
	at 
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(PartialCompositeDirContext.java:236)
	at 
javax.naming.directory.InitialDirContext.createSubcontext(InitialDirContext.java:178)

For some reason the creation of the first subcontext works fine although 
it uses custom schema attribute types and object classes as well. Here is 
the code:

    public synchronized void registerProfile(AuthorizationProfile profile) 
throws Exception
    {
        if (profile != null)
        {
            if (log.isInfoEnabled())
            {
                log.info(sm.getString("aaaRegistry.addProfile", 
profile.getName(), profile.getVin()));
            }

            try
            {
                Attributes attributes = new BasicAttributes(true);
                attributes.put(new 
BasicAttribute(DEVICE_ATTRIBUTES.VIN.name(), profile.getVin()));
                attributes.put(new 
BasicAttribute(DEVICE_ATTRIBUTES.VehicleID.name(), profile.getName()));

                Attribute objectClass = new BasicAttribute("objectClass", 
"top");
                objectClass.add("vehicle");
                objectClass.add("consumer");
                attributes.put(objectClass);

                DirContext generatedContext = 
context.createSubcontext(profile.getDn(), attributes);

                if (profile.getRoles() != null && 
!profile.getRoles().isEmpty())
                {
                    Attributes roleAttributes;

                    for (String role : profile.getRoles())
                    {
                        roleAttributes = new BasicAttributes(true);
                        roleAttributes.put(new 
BasicAttribute("serviceName", role));
                        roleAttributes.put(new 
BasicAttribute("activeFlag", "TRUE"));
                        objectClass = new BasicAttribute("objectClass", 
"top");
                        objectClass.add("assignedService");
                        roleAttributes.put(objectClass);

                        context.createSubcontext(
                                new 
StringBuilder("servicename=").append(role).append(", 
").append(profile.getDn())
                                        .toString(), roleAttributes);
                    }
                }
            }
            catch (NamingException e)
            {
                log.error(e.getMessage(), e);
                throw new 
Exception(sm.getString("aaaRegistry.cannotAddProfile"), e);
            }
        }
    }

Every hint is welcome!

Regards,
CAK

-- 
Carsten Kaiser
Principal Consultant
mailto:carsten.kaiser@valtech.de
Mobile: +49 170 5270206

Valtech GmbH
Werner-Heisenberg-Straße 2
63263 Neu-Isenburg
Germany

Phone: +49 6102 88468-0
Fax: +49 6102 88468-28

http://www.valtech.de

Geschäftsführer: Ingo Kriescher
Amtsgericht Düsseldorf HRB48672

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message