directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barber, Dan \(Contractor\)" <Dan.Bar...@Polycom.com>
Subject RE: Trying to create a new partition configuration class
Date Thu, 28 Jun 2007 15:09:19 GMT
Chris,

Thanks a lot for the detailed reply. I'd already picked up quite a bit
of this just by going through the code and figuring out where various
things are created, but it's good to know I was mostly on track.

I actually am not trying to go with very small baby steps at the moment.
What I hope to do is create a JdbcPartitionConfiguration class and a
JdbcPartition class that are exact replicas of existing classes, so that
I've added no new functionality, build them and get a directory working
with those, then I can begin to add our own functionality.

I made the first of those steps work just fine. I took a copy of
MutableBTreePartitionConfiguration, turned in into
JdbcPartitionConfiguration, built the code within our own package, jar'd
it, put it into the lib directory, changed example.com within server.xml
to use that new package, and started up ApacheDS. Worked like a champ.

Now, we don't feel like we need the BTree pieces for the partition we'll
be doing, so the next step was to directly extend
PartitionConfiguration, to create a class at the same level of
inheritance as BTreePartitionConfiguration. I essentially merged the
code from MutableBTreePartitionConfiguration and
BTreePartitionConfiguration, as I discovered the various properties that
are required by the Spring implementation. That was the
JdbcPartitionConfiguration that I included with my email yesterday. I
then went through the same process but now the partition doesn't load.
That's when I get the following error in the log:

[13:53:30] ERROR [org.apache.directory.daemon.Bootstrapper] - Failed on
org.apache.directory.server.Service.init(InstallationLayout, String[])
org.apache.directory.server.core.interceptor.InterceptorException:
Failed to initialize interceptor chain. [Root exception is
java.lang.NullPointerException]
	at
org.apache.directory.server.core.interceptor.InterceptorChain.init(Inter
ceptorChain.java:257)
	at
org.apache.directory.server.core.DefaultDirectoryService.initialize(Defa
ultDirectoryService.java:1006)
	at
org.apache.directory.server.core.DefaultDirectoryService.startup(Default
DirectoryService.java:254)
	at
org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialC
ontext(AbstractContextFactory.java:123)
	at javax.naming.spi.NamingManager.getInitialContext(Unknown
Source)
	at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
	at javax.naming.InitialContext.init(Unknown Source)
	at javax.naming.InitialContext.<init>(Unknown Source)
	at javax.naming.directory.InitialDirContext.<init>(Unknown
Source)
	at org.apache.directory.server.Service.init(Service.java:96)
	at
org.apache.directory.daemon.Bootstrapper.callInit(Bootstrapper.java:151)
	at
org.apache.directory.daemon.ProcrunBootstrapper.prunsrvStart(ProcrunBoot
strapper.java:65)
Caused by: java.lang.NullPointerException
	at
org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerat
or.enumConj(ExpressionEnumerator.java:250)
	at
org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerat
or.enumerate(ExpressionEnumerator.java:140)
	at
org.apache.directory.server.core.partition.impl.btree.DefaultSearchEngin
e.search(DefaultSearchEngine.java:135)
	at
org.apache.directory.server.core.partition.impl.btree.BTreePartition.sea
rch(BTreePartition.java:431)
	at
org.apache.directory.server.core.partition.DefaultPartitionNexus.search(
DefaultPartitionNexus.java:922)
	at
org.apache.directory.server.core.authz.GroupCache.initialize(GroupCache.
java:146)
	at
org.apache.directory.server.core.authz.GroupCache.<init>(GroupCache.java
:117)
	at
org.apache.directory.server.core.authz.AuthorizationService.init(Authori
zationService.java:200)
	at
org.apache.directory.server.core.interceptor.InterceptorChain.register0(
InterceptorChain.java:419)
	at
org.apache.directory.server.core.interceptor.InterceptorChain.register(I
nterceptorChain.java:378)
	at
org.apache.directory.server.core.interceptor.InterceptorChain.init(Inter
ceptorChain.java:243)
	... 11 more

I thought perhaps some of the entries in server.xml were somehow not
compatible with a Partition that doesn't extend
MutableBTreePartitionConfiguration, but that didn't seem to help
anything. I'm somewhat confused, my class should look identical to
MutableBTreePartitionConfiguration other than it doesn't extend
BTreePartitionConfiguration, it directly extends PartitionConfiguration.
There isn't anything in the code currently that expects a
PartitionConfiguration to have BTreePartitionConfiguration in its
inheritance tree is there?

Perhaps another piece of useful information. The error that I am getting
is the same stack trace that I get if I set "optimizerEnabled" to false
within the default server.xml for example.com. I currently have no idea
whether those two are actually related, or if I just happened across
some bizarre coincidence, but since I found it I thought I'd include
that information.

If this triggers any additional questions, please ask, I'll be happy to
provide anything I can.

Thanks,

Dan 

-----Original Message-----
From: Chris Custine [mailto:chris.custine@gmail.com] 
Sent: Wednesday, June 27, 2007 11:09 PM
To: users@directory.apache.org
Subject: Re: Trying to create a new partition configuration class

If I understand all of this correctly, I think the problem is that
PartitionConfiguration which is the base for
MutableBTreePartitionConfiguration and BTreePartitionConfiguration is
specific to JdbmPartition and instantiates the JdbmPartition.  We need
to
make some improvements to make this easier and more intuitive, but in
the
mean time you can do the following things to get you closer to a custom
partition:

1).  Take the PartitionConfiguration class and create a
JdbcPartitionConfiguration from it.  We need to make this more
intuitive,
but this is just a POJO to receive the config properties from the
server.xmlthat are specific to your partition, and this bean creates
the partition
object when Spring initializes.
2).  You will need to implement your own actual partition (ie
JdbcPartition
which extends AbstractPartition) and return a configured instance of it
from
your JdbcPartitionConfiguration.getContextPartition().
3).  There are a few properties in PartitionConfiguration that look like
they are required, even though we have no interface to enforce.  In
particular it looks like getIndexedAttributes() is called by
DefaultDirectoryService, so you may have to keep a stub of it in your
JdbcPartitionConfig.

There may actually be other uses of methods in PartitionConfiguration
that
are required, but this is an area that needs a little clean up so bear
with
us...

Hopefully this helps you out a bit.  This is not an area that is
completely
intuitive and I have actually never had to do this yet.  We are getting
ready to add some new optional partition types so we will undoubtedly be
running into the same issues and fixing them.  Please let me know how
this
works out for you and if there are any inaccuracies in what I said.  I
will
file a Jira issue about cleaning up the PartitionConfiguration
heirarchy,
etc. so that we get that fixed.

Thanks,
Chris

On 6/27/07, Barber, Dan (Contractor) <Dan.Barber@polycom.com> wrote:
>
>  This is the initial part of my effort to extend ApacheDS to use a
> different partition. I'm trying to essentially replicate existing
ApacheDS
> classes but as my own classes. Once I've got the service starting
using all
> my own classes then I can begin to modify them for my purposes.
>
>
>
> First, I just made my own version of
MutableBTreePartitionConfiguration,
> changing only the package and class names. Included a jar file with
that new
> class in apache's lib directory, modified server.xml to now create the
> example.com partition using my new partition configuration class,
> everything worked perfectly.
>
>
>
> Next step, I don't think we want a BTree-based implementation, so I
tried
> to extend directly from PartitionConfiguration. In that class I
attempted to
> pretty much duplicate the functionality in both
MutableBTreeConfiguration
> and BTreePartitionConfiguration. I can't seem to get this to work.
>
>
>
> Here's what I'm getting in apacheds's rolling log:
>
>
>
> [13:53:30] ERROR [org.apache.directory.daemon.Bootstrapper] - Failed
on
> org.apache.directory.server.Service.init(InstallationLayout, String[])
>
> org.apache.directory.server.core.interceptor.InterceptorException:
Failed
> to initialize interceptor chain. [Root exception is
> java.lang.NullPointerException]
>
>             at
> org.apache.directory.server.core.interceptor.InterceptorChain.init(
> InterceptorChain.java:257)
>
>             at
> org.apache.directory.server.core.DefaultDirectoryService.initialize(
> DefaultDirectoryService.java:1006)
>
>             at
> org.apache.directory.server.core.DefaultDirectoryService.startup(
> DefaultDirectoryService.java:254)
>
>             at
>
org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialC
ontext
> (AbstractContextFactory.java:123)
>
>             at
javax.naming.spi.NamingManager.getInitialContext(Unknown
> Source)
>
>             at javax.naming.InitialContext.getDefaultInitCtx(Unknown
> Source)
>
>             at javax.naming.InitialContext.init(Unknown Source)
>
>             at javax.naming.InitialContext.<init>(Unknown Source)
>
>             at javax.naming.directory.InitialDirContext.<init>(Unknown
> Source)
>
>             at
org.apache.directory.server.Service.init(Service.java:96)
>
>             at org.apache.directory.daemon.Bootstrapper.callInit(
> Bootstrapper.java:151)
>
>             at
> org.apache.directory.daemon.ProcrunBootstrapper.prunsrvStart(
> ProcrunBootstrapper.java:65)
>
> Caused by: java.lang.NullPointerException
>
>             at
>
org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerat
or.enumConj
> (ExpressionEnumerator.java:250)
>
>             at
>
org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerat
or.enumerate
> (ExpressionEnumerator.java:140)
>
>             at
>
org.apache.directory.server.core.partition.impl.btree.DefaultSearchEngin
e.search
> (DefaultSearchEngine.java:135)
>
>             at
>
org.apache.directory.server.core.partition.impl.btree.BTreePartition.sea
rch
> (BTreePartition.java:431)
>
>             at
>
org.apache.directory.server.core.partition.DefaultPartitionNexus.search(
> DefaultPartitionNexus.java:922)
>
>             at
> org.apache.directory.server.core.authz.GroupCache.initialize(
> GroupCache.java:146)
>
>             at
org.apache.directory.server.core.authz.GroupCache.<init>(
> GroupCache.java:117)
>
>             at
> org.apache.directory.server.core.authz.AuthorizationService.init(
> AuthorizationService.java:200)
>
>             at
>
org.apache.directory.server.core.interceptor.InterceptorChain.register0(
> InterceptorChain.java:419)
>
>             at
>
org.apache.directory.server.core.interceptor.InterceptorChain.register(
> InterceptorChain.java:378)
>
>             at
> org.apache.directory.server.core.interceptor.InterceptorChain.init(
> InterceptorChain.java:243)
>
>             ... 11 more
>
>
>
> I've also attached the server.xml and java code for my new class. Any
> ideas what is going on?
>
>
>
> Thanks,
>
>
>
> Dan
>
>
>
>

Mime
View raw message