Directory Partitions Question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Directory Project > Directory Partitions Question




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Directory Partitions Question  
Ole Ersoy


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-26-06 10:45 PM

Hey Guys,

I'm testing out adding a partition for
dc=apache,dc=org in RC1.

I added it right beneath dc=example,dc=com in the
server.xml file.

When I try to create a context beneath
dc=example,dc=com
no problemo, the unit test runs smooth.

However, when running it for dc=apache,dc=org, not so
smooth.

Originally I took the dc=apache,dc=org entry from the
"Partition" documentation.  I had to change the Spring
class attribute (Which I updated in the documentation)
to match the one used in the dc=example,
configuration, otherwise the server complained during
startup in debug mode.

I also changed the indexAttributes elements to match
the ones in dc=example.

Now I make the corresponding changes in the unit test,
aaaand fire it up!  All red.  Actually I don't even
get a red, just the console in Eclipse.

I looked through the configuration file, to see if
there was some other element that was making the
dc=example partition work.  I could not find one.  Is
there one?

Here is the dc=apache configuration element I added
(Including the example one just for reference):

<bean id="examplePartitionConfiguration"
class="org.apache.directory.server.core.configuration.MutableDirectoryPartit
ionConfiguration">
<property
name="name"><value>example</value></property>
<property
name="suffix"><value>dc=example,dc=com</value></property>
<property name="indexedAttributes">
<set>
<value>dc</value>
<value>ou</value>
<value>objectClass</value>
<value>krb5PrincipalName</value>
<value>uid</value>
</set>
</property>
<property name="contextEntry">
<value>
objectClass: top
objectClass: domain
objectClass: extensibleObject
dc: example
</value>
</property>
</bean>


<!-- Additional ContextPartitionConfiguration -->
<bean id="apachePartitionConfiguration"
class="org.apache.directory.server.core.configuration.MutableDirectoryPartit
ionConfiguration">
<property
name="name"><value>apache</value></property>
<property
name="suffix"><value>dc=apache,dc=org</value></property>
<property name="indexedAttributes">
<set>
<value>dc</value>
<value>ou</value>
<value>objectClass</value>
<value>krb5PrincipalName</value>
<value>uid</value>
</set>
<property name="contextEntry">
<value>
objectClass: top
objectClass: domain
objectClass: extensibleObject
dc: apache
</value>
</property>
</bean>

And here is the unit test code:

package com.pyramidetechnologies.webapp.mdc;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;

import junit.framework.TestCase;

public class TestNewContextSetup extends TestCase {

public DirContext authenticate() {
try {
Hashtable<String, String> env = new
Hashtable<String, String>();
//			 Set up the environment for creating the initial
context
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,
"ldap://localhost:389/dc=apache,dc=org");

//			 Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL,
"uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");

DirContext ctx = new InitialDirContext(env);

ctx.createSubcontext("mail=ole-sg9fheiuwuRtdF/iL03xVDBc0kxJFkfs@public.gmane
.org");

ctx.destroySubcontext("mail=ole-sg9fheiuwuRtdF/iL03xVDBc0kxJFkfs@public.gman
e.org");
return ctx;
} catch (NamingException e) {
e.printStackTrace();
return null;
}
}

public void testAddContext() throws NamingException {
DirContext ctx=authenticate();
Name ole = null;
//ctx.destroySubcontext("pyramide technologies");
//ctx.bind(ole,
ctx.lookup("mail=ole-sg9fheiuwuRtdF/iL03xVDBc0kxJFkfs@public.gmane.org"));

//ctx.destroySubcontext("mail=ole-sg9fheiuwuRtdF/iL03xVDBc0kxJFkfs@public.gm
ane.org");
}
}

Any idea on what I'm missing?

Thanks,
- Ole

 ________________________________________
__________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com






[ Post a follow-up to this message ]



    Re: Directory Partitions Question  
Stefan Zoerner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-26-06 10:45 PM

Ole Ersoy wrote:

> I'm testing out adding a partition for
> dc=apache,dc=org in RC1.
>
> I added it right beneath dc=example,dc=com in the
> server.xml file.
>
> When I try to create a context beneath
> dc=example,dc=com
> no problemo, the unit test runs smooth.
>
> However, when running it for dc=apache,dc=org, not so
> smooth.
>
> Originally I took the dc=apache,dc=org entry from the
> "Partition" documentation.  I had to change the Spring
> class attribute (Which I updated in the documentation)
> to match the one used in the dc=example,
> configuration, otherwise the server complained during
> startup in debug mode.
>
> I also changed the indexAttributes elements to match
> the ones in dc=example.
>
> Now I make the corresponding changes in the unit test,
> aaaand fire it up!  All red.  Actually I don't even
> get a red, just the console in Eclipse.
>
> I looked through the configuration file, to see if
> there was some other element that was making the
> dc=example partition work.  I could not find one.  Is
> there one?

Hello Ole!

Adding an element for the partition is not enough. If you look at the

<bean id="examplePartitionConfiguration"
class="...server.core.configuration.MutableDirectoryPartitionConfiguration">
...

partition of the default server.xml, this bean as an id
"examplePartitionConfiguration", which is used in the bean with id
"configuration" in a property like this:

<property name="contextPartitionConfigurations">
<set>
<ref bean="examplePartitionConfiguration"/>
</set>
</property>


Have you added a corresponding entry for your
apachePartitionConfiguration, i.e.

<property name="contextPartitionConfigurations">
<set>
<ref bean="examplePartitionConfiguration"/>
<ref bean="apachePartitionConfiguration"/>
</set>
</property>

This might be the problem.

Hope this helps + Greetings from Hamburg
Stefan








[ Post a follow-up to this message ]



    Re: Directory Partitions Question  
Stefan Zoerner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-26-06 10:45 PM

Hi Ole!

Ole Ersoy wrote:
> Stefan,
>
> Thanks!  Works like a dream now!

Nice to hear that. Should add an instruction for that to the tutorial
(trail "How to begin").

> The tutorial skeleton is looking pretty solid by the
> way.  I started playing with jexplorer a little, and
> I'll add my notes when I get a chance.
>
> Should I send them to you for review or just put them
> in the document directly?

I guess it is easier if you contribute to Confluence directly. This is
what a wiki is for, and currently I do not have enough time for the
tutorial anyway. I have to finish a portlet book until and of march.
After that I plan to create some more content for the tutorial. But the
whole tutorial with all the topics is probably too ambitious for me
alone -- support is definitely appreciated!

Greetings from Hamburg,
Stefan







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:08 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register