You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2019/01/04 07:05:13 UTC

[directory-server] branch master updated (d560fc9 -> 4ce5d95)

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git.


    from d560fc9  Merge pull request #10 from coheigea/jetty-upgrade
     new 5d40c41  Bumped up ehcache version to 3.6.1
     new 4ce5d95  Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core-api/pom.xml                                   |  15 +-
 .../directory/server/core/api/CacheService.java    | 137 ++++-----
 .../src/main/resources/directory-cacheservice.xml  | 324 +++++++++++++--------
 core-integ/src/test/resources/log4j.properties     |   2 +-
 core-shared/pom.xml                                |   4 +-
 .../server/core/shared/DefaultDnFactory.java       |  16 +-
 .../server/core/DefaultDirectoryService.java       |   6 +-
 .../server/installers/archive/log4j.properties     |   2 +-
 .../directory/server/installers/log4j.properties   |   2 +-
 interceptors/authz/pom.xml                         |   4 +-
 .../directory/server/core/authz/GroupCache.java    |  72 ++---
 interceptors/hash/pom.xml                          |  10 -
 interceptors/logger/pom.xml                        |   5 -
 interceptors/subtree/pom.xml                       |   4 +-
 .../server/core/subtree/SubtreeEvaluatorTest.java  |  17 +-
 jdbm-partition/pom.xml                             |   3 +-
 .../partition/impl/btree/jdbm/JdbmPartition.java   |  51 ++--
 .../partition/impl/btree/jdbm/JdbmStoreTest.java   |   3 +-
 .../core/partition/tree/PartitionTreeTest.java     |   3 +-
 kerberos-codec/pom.xml                             |   5 +-
 .../kerberos/shared/replay/ReplayCacheImpl.java    |  58 +---
 .../shared/replay/ReplayCacheImplTest.java         |  60 ++--
 .../src/test/resources/log4j.properties            |   2 +-
 .../core/partition/ldif/LdifPartitionTest.java     |   3 +-
 ...SingleFileLdifPartitionSingeValueAttribute.java |   3 +-
 .../ldif/SingleFileLdifPartitionTest.java          |   3 +-
 mavibot-partition/pom.xml                          |   2 +-
 .../impl/btree/mavibot/MavibotPartition.java       |  42 +--
 .../impl/btree/mavibot/MavibotStoreTest.java       |   3 +-
 non-osgi-dependencies/pom.xml                      |   4 +-
 pom.xml                                            |   4 +-
 .../server/changepw/ChangePasswordServer.java      |   2 +-
 protocol-kerberos/pom.xml                          |   4 +-
 .../kerberos/changepwd/ChangePasswordServer.java   |   6 +-
 .../directory/server/kerberos/kdc/KdcServer.java   |   6 +-
 .../config/ChangePasswordConfigReaderTest.java     |   3 +-
 .../server/config/ConfigPartitionReaderTest.java   |   3 +-
 .../directory/server/config/ConfigWriterTest.java  |   3 +-
 .../server/config/HttpServerConfigReaderTest.java  |   3 +-
 .../config/KerberosServerConfigReaderTest.java     |   3 +-
 .../server/config/LdapServerConfigReaderTest.java  |   3 +-
 server-integ/src/test/resources/log4j.properties   |   2 +-
 .../src/test/resources/log4j.properties            |   2 +-
 service/log4j.properties                           |   2 +-
 .../apache/directory/server/ApacheDsService.java   |   3 +-
 xdbm-partition/pom.xml                             |   5 +-
 .../impl/btree/AbstractBTreePartition.java         |  72 ++---
 .../org/apache/directory/server/xdbm/Store.java    |   4 +-
 .../search/evaluator/SubtreeScopeEvaluator.java    |   8 +-
 .../xdbm/search/impl/DefaultSearchEngine.java      |   9 +-
 .../directory/server/xdbm/PartitionTest.java       |   2 -
 .../server/xdbm/impl/avl/AvlPartitionTest.java     |   5 +-
 .../server/xdbm/search/impl/EqualityTest.java      |   3 +-
 .../xdbm/search/impl/GreaterEqNotIndexedTest.java  |   3 +-
 .../server/xdbm/search/impl/GreaterEqTest.java     |   4 +-
 .../server/xdbm/search/impl/LessEqTest.java        |   4 +-
 .../server/xdbm/search/impl/PresenceTest.java      |   4 +-
 .../server/xdbm/search/impl/SubstringTest.java     |   4 +-
 58 files changed, 511 insertions(+), 530 deletions(-)


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Richard Sand <rs...@idfconnect.com>.
I haven’t but I’ll give it a shot this weekend and keep you posted

Sent from my iPhone

> On Jan 11, 2019, at 5:11 PM, Stefan Seelmann <ma...@stefan-seelmann.de> wrote:
> 
> On 1/6/19 3:18 AM, Stefan Seelmann wrote:
>>> Also the server build now fails with Java 11. That's because ehcache 3
>>> uses JAXB (I assume to load XML config), but JAXB was removed from Java
>>> SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.
> 
> I give up. I searched and tried many workarounds but I don't get
> JAXB+Java11+OSGi working together. There is an open issue [1] for reference.
> 
> @Richard, did you already start with using Caffein/JSR-107? Otherwise
> I'd give it a try...
> 
> Otherwise I'd think about rolling back to ehache 2...
> 
> Kind Regards,
> Stefan
> 
> [1] https://github.com/eclipse-ee4j/jaxb-api/issues/78

Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Richard Sand <rs...@idfconnect.com>.
Caffeine has a jsr-107 adapter - we could do jsr-107 and provide a default caffeine implementation and configuration, wdyt?

Sent from my iPhone

> On Jan 11, 2019, at 5:31 PM, Emmanuel Lécharny <el...@gmail.com> wrote:
> 
> 
>> On 11/01/2019 23:11, Stefan Seelmann wrote:
>> On 1/6/19 3:18 AM, Stefan Seelmann wrote:
>>>> Also the server build now fails with Java 11. That's because ehcache 3
>>>> uses JAXB (I assume to load XML config), but JAXB was removed from Java
>>>> SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.
>> I give up. I searched and tried many workarounds but I don't get
>> JAXB+Java11+OSGi working together. There is an open issue [1] for reference.
>> 
>> @Richard, did you already start with using Caffein/JSR-107? Otherwise
>> I'd give it a try...
>> 
>> Otherwise I'd think about rolling back to ehache 2...
> 
> 
> What about moving to Caffeine ?
> 
> 

Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Emmanuel Lécharny <el...@gmail.com>.
On 30/03/2019 09:38, Stefan Seelmann wrote:
> On 1/21/19 5:04 AM, Emmanuel Lécharny wrote:
>> On 21/01/2019 03:16, Richard Sand wrote:
>>> HI guys -
>>>
>>> I cloned master to start swapping the ehcahe3 to caffeine. But because
>>> caffeine is actually a bit more similar to ehcache2, I’m thinking of
>>> going back to AM25 and starting from there. What do you think?
>>
>> Sure ! There are not that many changes in trunk, merging your changes
>> should be quite easy.
> I started an inital attempt, using JCache API and Caffeine, but with
> this combination I still have failing OSGi tests. I'll do another
> attempt to only use Caffeine without JCache.
I think Caffeine only is good enough.


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
On 1/21/19 5:04 AM, Emmanuel Lécharny wrote:
> 
> On 21/01/2019 03:16, Richard Sand wrote:
>> HI guys -
>>
>> I cloned master to start swapping the ehcahe3 to caffeine. But because
>> caffeine is actually a bit more similar to ehcache2, I’m thinking of
>> going back to AM25 and starting from there. What do you think?
> 
> 
> Sure ! There are not that many changes in trunk, merging your changes
> should be quite easy.

I started an inital attempt, using JCache API and Caffeine, but with
this combination I still have failing OSGi tests. I'll do another
attempt to only use Caffeine without JCache.

Kind Regards,
Stefan


[1] https://github.com/apache/directory-server/pull/13


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Emmanuel Lécharny <el...@gmail.com>.
On 21/01/2019 03:16, Richard Sand wrote:
> HI guys -
>
> I cloned master to start swapping the ehcahe3 to caffeine. But because 
> caffeine is actually a bit more similar to ehcache2, I’m thinking of 
> going back to AM25 and starting from there. What do you think?


Sure ! There are not that many changes in trunk, merging your changes 
should be quite easy.


Thanks !



Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Richard Sand <rs...@idfconnect.com>.
HI guys - 

I cloned master to start swapping the ehcahe3 to caffeine. But because caffeine is actually a bit more similar to ehcache2, I’m thinking of going back to AM25 and starting from there. What do you think?

Best regards,

Richard


> On Jan 11, 2019, at 5:31 PM, Emmanuel Lécharny <el...@gmail.com> wrote:
> 
> 
> On 11/01/2019 23:11, Stefan Seelmann wrote:
>> On 1/6/19 3:18 AM, Stefan Seelmann wrote:
>>>> Also the server build now fails with Java 11. That's because ehcache 3
>>>> uses JAXB (I assume to load XML config), but JAXB was removed from Java
>>>> SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.
>> I give up. I searched and tried many workarounds but I don't get
>> JAXB+Java11+OSGi working together. There is an open issue [1] for reference.
>> 
>> @Richard, did you already start with using Caffein/JSR-107? Otherwise
>> I'd give it a try...
>> 
>> Otherwise I'd think about rolling back to ehache 2...
> 
> 
> What about moving to Caffeine ?
> 
> 


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Emmanuel Lécharny <el...@gmail.com>.
On 11/01/2019 23:11, Stefan Seelmann wrote:
> On 1/6/19 3:18 AM, Stefan Seelmann wrote:
>>> Also the server build now fails with Java 11. That's because ehcache 3
>>> uses JAXB (I assume to load XML config), but JAXB was removed from Java
>>> SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.
> I give up. I searched and tried many workarounds but I don't get
> JAXB+Java11+OSGi working together. There is an open issue [1] for reference.
>
> @Richard, did you already start with using Caffein/JSR-107? Otherwise
> I'd give it a try...
>
> Otherwise I'd think about rolling back to ehache 2...


What about moving to Caffeine ?



Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
On 1/6/19 3:18 AM, Stefan Seelmann wrote:
>> Also the server build now fails with Java 11. That's because ehcache 3
>> uses JAXB (I assume to load XML config), but JAXB was removed from Java
>> SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.

I give up. I searched and tried many workarounds but I don't get
JAXB+Java11+OSGi working together. There is an open issue [1] for reference.

@Richard, did you already start with using Caffein/JSR-107? Otherwise
I'd give it a try...

Otherwise I'd think about rolling back to ehache 2...

Kind Regards,
Stefan

[1] https://github.com/eclipse-ee4j/jaxb-api/issues/78

Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
On 1/5/19 8:40 PM, Stefan Seelmann wrote:
> Maybe it's the perfect time, because I'm struggling with using ApacheDS
> with ehcache3 in Studio, OSGi related issues.

This is fixed now. I had to downgrade to version 3.5.3, see
https://github.com/ehcache/ehcache3/issues/2554 for details.

But I'd really prefer a simpler default cache solution :)

> Also the server build now fails with Java 11. That's because ehcache 3
> uses JAXB (I assume to load XML config), but JAXB was removed from Java
> SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.
> 
> Kind Regards,
> Stefan
> 
> On 1/5/19 8:10 PM, Richard Sand wrote:
>> Want me to open a pull request for jsr107 and a default caffeine impl? Or is this not the time
>>
>> -Richard
>>
>>> On Jan 5, 2019, at 1:42 AM, Emmanuel Lécharny <el...@gmail.com> wrote:
>>>
>>>
>>>> On 05/01/2019 03:05, Richard Sand wrote:
>>>> Sorry I should have brought that up at the start!
>>>>
>>>> When have you planned to implement jsr-107?
>>>
>>> We haven't... This came quite late  (2014) and we even haven't discussed about it yet :-)
>>>
>>>
>>>
>>>> Having gone through this exercise, I think abstracting ehcache from the code is a good idea.
>>>
>>> I don't disagree.
>>>
>>>
>>>>  Also I checked out Caffeine and tested it in my company’s product, so far it seems good as a lightweight local cache fwiw.
>>>
>>> I do think it's probably what we should aim for, instead of using ehcache, which is quite an elephant piece of code.
>>>
>>> As you realized, the cache is used pretty much everywhere in the server's code, and changing it is not easy, but it's probably easier if we abstract it.
>>>
>>> I don't have any prevention about such a change.
>>>
>>>
> 


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
Maybe it's the perfect time, because I'm struggling with using ApacheDS
with ehcache3 in Studio, OSGi related issues.

Also the server build now fails with Java 11. That's because ehcache 3
uses JAXB (I assume to load XML config), but JAXB was removed from Java
SE in 11. Solution is to add JAXB dependency. Would be nice to avoid that.

Kind Regards,
Stefan

On 1/5/19 8:10 PM, Richard Sand wrote:
> Want me to open a pull request for jsr107 and a default caffeine impl? Or is this not the time
> 
> -Richard
> 
>> On Jan 5, 2019, at 1:42 AM, Emmanuel Lécharny <el...@gmail.com> wrote:
>>
>>
>>> On 05/01/2019 03:05, Richard Sand wrote:
>>> Sorry I should have brought that up at the start!
>>>
>>> When have you planned to implement jsr-107?
>>
>> We haven't... This came quite late  (2014) and we even haven't discussed about it yet :-)
>>
>>
>>
>>> Having gone through this exercise, I think abstracting ehcache from the code is a good idea.
>>
>> I don't disagree.
>>
>>
>>>  Also I checked out Caffeine and tested it in my company’s product, so far it seems good as a lightweight local cache fwiw.
>>
>> I do think it's probably what we should aim for, instead of using ehcache, which is quite an elephant piece of code.
>>
>> As you realized, the cache is used pretty much everywhere in the server's code, and changing it is not easy, but it's probably easier if we abstract it.
>>
>> I don't have any prevention about such a change.
>>
>>


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Richard Sand <rs...@idfconnect.com>.
Want me to open a pull request for jsr107 and a default caffeine impl? Or is this not the time

-Richard

> On Jan 5, 2019, at 1:42 AM, Emmanuel Lécharny <el...@gmail.com> wrote:
> 
> 
>> On 05/01/2019 03:05, Richard Sand wrote:
>> Sorry I should have brought that up at the start!
>> 
>> When have you planned to implement jsr-107?
> 
> We haven't... This came quite late  (2014) and we even haven't discussed about it yet :-)
> 
> 
> 
>> Having gone through this exercise, I think abstracting ehcache from the code is a good idea.
> 
> I don't disagree.
> 
> 
>>  Also I checked out Caffeine and tested it in my company’s product, so far it seems good as a lightweight local cache fwiw.
> 
> I do think it's probably what we should aim for, instead of using ehcache, which is quite an elephant piece of code.
> 
> As you realized, the cache is used pretty much everywhere in the server's code, and changing it is not easy, but it's probably easier if we abstract it.
> 
> I don't have any prevention about such a change.
> 
> 

Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Emmanuel Lécharny <el...@gmail.com>.
On 05/01/2019 03:05, Richard Sand wrote:
> Sorry I should have brought that up at the start!
>
> When have you planned to implement jsr-107?

We haven't... This came quite late  (2014) and we even haven't discussed 
about it yet :-)



> Having gone through this exercise, I think abstracting ehcache from the code is a good idea.

I don't disagree.


>   Also I checked out Caffeine and tested it in my company’s product, so far it seems good as a lightweight local cache fwiw.

I do think it's probably what we should aim for, instead of using 
ehcache, which is quite an elephant piece of code.

As you realized, the cache is used pretty much everywhere in the 
server's code, and changing it is not easy, but it's probably easier if 
we abstract it.

I don't have any prevention about such a change.



Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Richard Sand <rs...@idfconnect.com>.
Sorry I should have brought that up at the start!

When have you planned to implement jsr-107? Having gone through this exercise, I think abstracting ehcache from the code is a good idea. Also I checked out Caffeine and tested it in my company’s product, so far it seems good as a lightweight local cache fwiw. 

-Richard

> On Jan 4, 2019, at 7:32 PM, Emmanuel Lécharny <el...@gmail.com> wrote:
> 
> 
>> On 05/01/2019 00:45, Stefan Seelmann wrote:
>>> On 1/4/19 8:05 AM, elecharny@apache.org wrote:
>>> diff --git a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
>>> index 33d6c2e..1de75b1 100644
>>> --- a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
>>> +++ b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
>>> @@ -20,20 +20,29 @@
>>>  package org.apache.directory.server.kerberos.shared.replay;
>>>    -import static org.junit.Assert.assertEquals;
>>> +import static org.junit.Assert.assertFalse;
>>>  import static org.junit.Assert.assertNull;
>>>  import static org.junit.Assert.assertTrue;
>>>  +import java.time.Duration;
>> Just a note, this breaks Java 7 compatibility. I know it's EOL and 8 too
>> soon, but it still ApacheDS still runs with Java 7. I'm fine with it,
>> but then let's also update compiler level and documentation. Thoughts?
> 
> 
> Ouch, didn't realized that. OTOH, Java 7 is EOL since April 2015 - almost 4 years now -.
> 
> 
> So, yes, update compiler level and doc is the way to go.
> 
> 
> Will do that.
> 
> 
> Thanks for the heads up Stefan !
> 

Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Emmanuel Lécharny <el...@gmail.com>.
On 05/01/2019 00:45, Stefan Seelmann wrote:
> On 1/4/19 8:05 AM, elecharny@apache.org wrote:
>> diff --git a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
>> index 33d6c2e..1de75b1 100644
>> --- a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
>> +++ b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
>> @@ -20,20 +20,29 @@
>>   package org.apache.directory.server.kerberos.shared.replay;
>>   
>>   
>> -import static org.junit.Assert.assertEquals;
>> +import static org.junit.Assert.assertFalse;
>>   import static org.junit.Assert.assertNull;
>>   import static org.junit.Assert.assertTrue;
>>   
>> +import java.time.Duration;
> Just a note, this breaks Java 7 compatibility. I know it's EOL and 8 too
> soon, but it still ApacheDS still runs with Java 7. I'm fine with it,
> but then let's also update compiler level and documentation. Thoughts?


Ouch, didn't realized that. OTOH, Java 7 is EOL since April 2015 - 
almost 4 years now -.


So, yes, update compiler level and doc is the way to go.


Will do that.


Thanks for the heads up Stefan !


Re: [directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
On 1/4/19 8:05 AM, elecharny@apache.org wrote:
> diff --git a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
> index 33d6c2e..1de75b1 100644
> --- a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
> +++ b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
> @@ -20,20 +20,29 @@
>  package org.apache.directory.server.kerberos.shared.replay;
>  
>  
> -import static org.junit.Assert.assertEquals;
> +import static org.junit.Assert.assertFalse;
>  import static org.junit.Assert.assertNull;
>  import static org.junit.Assert.assertTrue;
>  
> +import java.time.Duration;

Just a note, this breaks Java 7 compatibility. I know it's EOL and 8 too
soon, but it still ApacheDS still runs with Java 7. I'm fine with it,
but then let's also update compiler level and documentation. Thoughts?

Kind Regards,
Stefan

[directory-server] 01/02: Bumped up ehcache version to 3.6.1

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit 5d40c41ddfd7e3af2a30524ba7c495428a0aff49
Author: Emmanuel Lecharny <el...@apache.org>
AuthorDate: Fri Jan 4 08:04:42 2019 +0100

    Bumped up ehcache version to 3.6.1
---
 core-api/pom.xml                                   |  15 +-
 .../directory/server/core/api/CacheService.java    | 137 ++++-----
 .../src/main/resources/directory-cacheservice.xml  | 324 +++++++++++++--------
 core-integ/src/test/resources/log4j.properties     |   2 +-
 core-shared/pom.xml                                |   4 +-
 .../server/core/shared/DefaultDnFactory.java       |  16 +-
 .../server/core/DefaultDirectoryService.java       |   6 +-
 .../server/installers/archive/log4j.properties     |   2 +-
 .../directory/server/installers/log4j.properties   |   2 +-
 interceptors/authz/pom.xml                         |   4 +-
 .../directory/server/core/authz/GroupCache.java    |  72 ++---
 interceptors/hash/pom.xml                          |  10 -
 interceptors/logger/pom.xml                        |   5 -
 interceptors/subtree/pom.xml                       |   4 +-
 .../server/core/subtree/SubtreeEvaluatorTest.java  |  17 +-
 jdbm-partition/pom.xml                             |   3 +-
 .../partition/impl/btree/jdbm/JdbmPartition.java   |  51 ++--
 .../partition/impl/btree/jdbm/JdbmStoreTest.java   |   3 +-
 .../core/partition/tree/PartitionTreeTest.java     |   3 +-
 kerberos-codec/pom.xml                             |   5 +-
 .../kerberos/shared/replay/ReplayCacheImpl.java    |  58 +---
 .../shared/replay/ReplayCacheImplTest.java         |  60 ++--
 .../src/test/resources/log4j.properties            |   2 +-
 .../core/partition/ldif/LdifPartitionTest.java     |   3 +-
 ...SingleFileLdifPartitionSingeValueAttribute.java |   3 +-
 .../ldif/SingleFileLdifPartitionTest.java          |   3 +-
 mavibot-partition/pom.xml                          |   2 +-
 .../impl/btree/mavibot/MavibotPartition.java       |  42 +--
 .../impl/btree/mavibot/MavibotStoreTest.java       |   3 +-
 non-osgi-dependencies/pom.xml                      |   4 +-
 pom.xml                                            |   4 +-
 .../server/changepw/ChangePasswordServer.java      |   2 +-
 protocol-kerberos/pom.xml                          |   4 +-
 .../kerberos/changepwd/ChangePasswordServer.java   |   6 +-
 .../directory/server/kerberos/kdc/KdcServer.java   |   6 +-
 .../config/ChangePasswordConfigReaderTest.java     |   3 +-
 .../server/config/ConfigPartitionReaderTest.java   |   3 +-
 .../directory/server/config/ConfigWriterTest.java  |   3 +-
 .../server/config/HttpServerConfigReaderTest.java  |   3 +-
 .../config/KerberosServerConfigReaderTest.java     |   3 +-
 .../server/config/LdapServerConfigReaderTest.java  |   3 +-
 server-integ/src/test/resources/log4j.properties   |   2 +-
 .../src/test/resources/log4j.properties            |   2 +-
 service/log4j.properties                           |   2 +-
 .../apache/directory/server/ApacheDsService.java   |   3 +-
 xdbm-partition/pom.xml                             |   5 +-
 .../impl/btree/AbstractBTreePartition.java         |  72 ++---
 .../org/apache/directory/server/xdbm/Store.java    |   4 +-
 .../search/evaluator/SubtreeScopeEvaluator.java    |   8 +-
 .../xdbm/search/impl/DefaultSearchEngine.java      |   9 +-
 .../directory/server/xdbm/PartitionTest.java       |   2 -
 .../server/xdbm/impl/avl/AvlPartitionTest.java     |   5 +-
 .../server/xdbm/search/impl/EqualityTest.java      |   3 +-
 .../xdbm/search/impl/GreaterEqNotIndexedTest.java  |   3 +-
 .../server/xdbm/search/impl/GreaterEqTest.java     |   4 +-
 .../server/xdbm/search/impl/LessEqTest.java        |   4 +-
 .../server/xdbm/search/impl/PresenceTest.java      |   4 +-
 .../server/xdbm/search/impl/SubstringTest.java     |   4 +-
 58 files changed, 511 insertions(+), 530 deletions(-)

diff --git a/core-api/pom.xml b/core-api/pom.xml
index 1eabce9..b4752e6 100644
--- a/core-api/pom.xml
+++ b/core-api/pom.xml
@@ -108,7 +108,7 @@
     </dependency>
     
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
 
@@ -157,6 +157,12 @@
           <instructions>
             <Bundle-SymbolicName>${project.groupId}.core.api</Bundle-SymbolicName>
             <Export-Package>
+                org.ehcache;version=${ehcache.version},
+                org.ehcache.Cache;version=${ehcache.version},
+                org.ehcache.config;version=${ehcache.version},
+                org.ehcache.config.builders;version=${ehcache.version},
+                org.ehcache.xml;version=${ehcache.version},
+                org.ehcache.xml.exceptions;version=${ehcache.version},
                 org.apache.directory.server.core.api;version=${project.version},
                 org.apache.directory.server.core.api.administrative;version=${project.version},
                 org.apache.directory.server.core.api.authn.ppolicy;version=${project.version},
@@ -176,8 +182,11 @@
                 org.apache.directory.server.core.api.subtree;version=${project.version}
             </Export-Package>
             <Import-Package>
-                net.sf.ehcache;version=${ehcache.version},
-                net.sf.ehcache.config;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
+                org.ehcache.Cache;version=${ehcache.version},
+                org.ehcache.config.builders;version=${ehcache.version},
+                org.ehcache.xml;version=${ehcache.version},
+                org.ehcache.xml.exceptions;version=${ehcache.version},
                 org.apache.commons.lang3;version=${commons.lang.version},
                 org.apache.directory.api.asn1.util;version=${org.apache.directory.api.version},
                 org.apache.directory.api.i18n;version=${org.apache.directory.api.version},
diff --git a/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java b/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
index 7a30d31..f0335f8 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
@@ -22,15 +22,16 @@ package org.apache.directory.server.core.api;
 
 
 import java.io.File;
-import java.util.UUID;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.ConfigurationFactory;
-
-import org.apache.directory.api.util.FileUtils;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+
+import org.ehcache.Cache;
+import org.ehcache.Cache.Entry;
+import org.ehcache.CacheManager;
+import org.ehcache.Status;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.ehcache.xml.XmlConfiguration;
+import org.ehcache.xml.exceptions.XmlConfigurationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,11 +55,31 @@ public class CacheService
     private static final Logger LOG = LoggerFactory.getLogger( CacheService.class );
 
     /** the ehcache cache manager */
-    private CacheManager cacheManager;
-
-    /** A flag telling if the cache Service has been intialized */
-    private boolean initialized;
+    private CacheManager cacheManager = null;
 
+    /**
+     * Utility method to dump the cache contents to a StringBuffer.
+     * This is needed because ehcache 3.x Cache objects only implements Iterable
+     * 
+     * @return a StringBuffer
+     */
+    public static final StringBuffer dumpCacheContentsToString( Cache< ?, ? > cache ) 
+    {
+        Iterator<?> it = cache.iterator();
+        StringBuffer sb = new StringBuffer();
+        
+        while ( it.hasNext() )
+        {
+            Cache.Entry< ?, ? > nextObj = ( Entry<?, ?> ) it.next();
+            sb.append( '\t' )
+            .append( nextObj.getKey().toString() )
+            .append( " -> " )
+            .append( nextObj.getValue().toString() )
+            .append( '\n' );
+        }
+        
+        return sb;
+    }
 
     /**
      * Creates a new instance of CacheService.
@@ -76,11 +97,6 @@ public class CacheService
     public CacheService( CacheManager cachemanager )
     {
         this.cacheManager = cachemanager;
-
-        if ( cachemanager != null )
-        {
-            initialized = true;
-        }
     }
 
 
@@ -103,24 +119,16 @@ public class CacheService
      */
     public void initialize( InstanceLayout layout, String instanceId )
     {
-        if ( initialized )
-        {
-            LOG.debug( "CacheService was already initialized, returning" );
-            return;
-        }
-
         LOG.debug( "CacheService initialization, for instance {}", instanceId );
 
-        if ( ( cacheManager != null ) && ( cacheManager.getStatus() == Status.STATUS_ALIVE ) )
+        if ( ( cacheManager != null ) && ( cacheManager.getStatus() == Status.AVAILABLE ) )
         {
-            LOG.warn( "cache service was already initialized and is alive" );
-            initialized = true;
+            LOG.warn( "cache service was already initialized and is available" );
 
             return;
         }
 
-        Configuration cc;
-        String cachePath = null;
+        XmlConfiguration cc = null;
 
         if ( layout != null )
         {
@@ -129,41 +137,32 @@ public class CacheService
             if ( !configFile.exists() )
             {
                 LOG.info( "no custom cache configuration was set, loading the default cache configuration" );
-                cc = ConfigurationFactory.parseConfiguration( getClass().getClassLoader().getResource(
+                cc = new XmlConfiguration( getClass( ).getClassLoader( ).getResource(
                     DIRECTORY_CACHESERVICE_XML ) );
             }
             else
             {
                 LOG.info( "loading cache configuration from the file {}", configFile );
-
-                cc = ConfigurationFactory.parseConfiguration( configFile );
+                
+                try
+                {
+                    cc = new XmlConfiguration( configFile.toURI( ).toURL( ) );
+                }
+                catch ( XmlConfigurationException | MalformedURLException e ) 
+                {
+                    LOG.error( "exception loading cache configuration from the file {}: {}", configFile, e.toString() );
+                }
             }
-
-            cachePath = layout.getCacheDirectory().getAbsolutePath();
         }
         else
         {
             LOG.info( "no custom cache configuration was set, loading the default cache configuration" );
-            cc = ConfigurationFactory.parseConfiguration( getClass().getClassLoader().getResource(
+            cc = new XmlConfiguration( getClass( ).getClassLoader( ).getResource(
                 DIRECTORY_CACHESERVICE_XML ) );
-
-            cachePath = FileUtils.getTempDirectoryPath();
-        }
-
-        String confName = UUID.randomUUID().toString();
-        cc.setName( confName );
-
-        if ( cachePath == null )
-        {
-            cachePath = FileUtils.getTempDirectoryPath();
         }
 
-        cachePath += File.separator + confName;
-        cc.getDiskStoreConfiguration().setPath( cachePath );
-
-        cacheManager = new CacheManager( cc );
-
-        initialized = true;
+        cacheManager = CacheManagerBuilder.newCacheManager( cc );
+        cacheManager.init();
     }
 
 
@@ -172,17 +171,15 @@ public class CacheService
      */
     public void destroy()
     {
-        if ( !initialized )
+        if ( cacheManager == null )
         {
             return;
         }
 
         LOG.info( "clearing all the caches" );
 
-        initialized = false;
-
-        cacheManager.clearAll();
-        cacheManager.shutdown();
+        cacheManager.close();
+        cacheManager = null;
     }
 
 
@@ -192,9 +189,9 @@ public class CacheService
      * @param name The Cache name we want to retreive
      * @return The found cache. If we don't find it, we create a new one.
      */
-    public Cache getCache( String name )
+    public <K, V> Cache<K, V> getCache( String name, Class<K> keyClazz, Class<V> valueClazz )
     {
-        if ( !initialized )
+        if ( cacheManager == null )
         {
             LOG.error( "Cannot fetch the cache named {}, the CacheServcie is not initialized", name );
             throw new IllegalStateException( "CacheService was not initialized" );
@@ -202,15 +199,8 @@ public class CacheService
 
         LOG.info( "fetching the cache named {}", name );
 
-        Cache cache = cacheManager.getCache( name );
-
-        if ( cache == null )
-        {
-            LOG.info( "No cache with name {} exists, creating one", name );
-            cacheManager.addCache( name );
-            cache = cacheManager.getCache( name );
-        }
-
+        Cache<K, V> cache = cacheManager.getCache( name, keyClazz, valueClazz );
+        
         return cache;
     }
 
@@ -222,15 +212,8 @@ public class CacheService
      */
     public void remove( String name )
     {
-        if ( cacheManager.cacheExists( name ) )
-        {
-            LOG.info( "Removing the cache named {}", name );
-
-            cacheManager.removeCache( name );
-        }
-        else
-        {
-            LOG.info( "Cannot removing the cache named {}, it does not exist", name );
-        }
+        LOG.info( "Removing the cache named {}", name );
+        
+        cacheManager.removeCache( name );
     }
 }
diff --git a/core-api/src/main/resources/directory-cacheservice.xml b/core-api/src/main/resources/directory-cacheservice.xml
index bd01a1a..f173899 100644
--- a/core-api/src/main/resources/directory-cacheservice.xml
+++ b/core-api/src/main/resources/directory-cacheservice.xml
@@ -17,85 +17,75 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<ehcache name="apacheds" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false"
-	monitoring="autodetect" dynamicConfig="true">
-
-	<diskStore path="java.io.tmpdir" />
-
-    <!--
-    Cache configuration
-    ===================
-
-    The following attributes are required.
-
-    name:
-    Sets the name of the cache. This is used to identify the cache. It must be unique.
-
-    maxElementsInMemory:
-    Sets the maximum number of objects that will be created in memory
-
-    maxElementsOnDisk:
-    Sets the maximum number of objects that will be maintained in the DiskStore
-    The default value is zero, meaning unlimited.
-
-    eternal:
-    Sets whether elements are eternal. If eternal,  timeouts are ignored and the
-    element is never expired.
-
-    overflowToDisk:
-    Sets whether elements can overflow to disk when the memory store
-    has reached the maxInMemory limit.
-
-    The following attributes and elements are optional.
-
-    timeToIdleSeconds:
-    Sets the time to idle for an element before it expires.
-    i.e. The maximum amount of time between accesses before an element expires
-    Is only used if the element is not eternal.
-    Optional attribute. A value of 0 means that an Element can idle for infinity.
-    The default value is 0.
-
-    timeToLiveSeconds:
-    Sets the time to live for an element before it expires.
-    i.e. The maximum time between creation time and when an element expires.
-    Is only used if the element is not eternal.
-    Optional attribute. A value of 0 means that and Element can live for infinity.
-    The default value is 0.
-
-    diskPersistent:
-    Whether the disk store persists between restarts of the Virtual Machine.
-    The default value is false.
-
-    diskExpiryThreadIntervalSeconds:
-    The number of seconds between runs of the disk expiry thread. The default value
-    is 120 seconds.
-
-    diskSpoolBufferSizeMB:
-    This is the size to allocate the DiskStore for a spool buffer. Writes are made
-    to this area and then asynchronously written to disk. The default size is 30MB.
-    Each spool buffer is used only by its cache. If you get OutOfMemory errors consider
-    lowering this value. To improve DiskStore performance consider increasing it. Trace level
-    logging in the DiskStore will show if put back ups are occurring.
-
-    clearOnFlush:
-    whether the MemoryStore should be cleared when flush() is called on the cache.
-    By default, this is true i.e. the MemoryStore is cleared.
-
-    memoryStoreEvictionPolicy:
-    Policy would be enforced upon reaching the maxElementsInMemory limit. Default
-    policy is Least Recently Used (specified as LRU). Other policies available -
-    First In First Out (specified as FIFO) and Less Frequently Used
-    (specified as LFU)
--->
-	<!-- Mandatory Default Cache configuration. These settings will be applied 
-		to caches created programmtically using CacheManager.add(String cacheName). 
-		The defaultCache has an implicit name "default" which is a reserved cache 
-		name. -->
-		
-	<defaultCache maxElementsInMemory="1" eternal="false"
-		overflowToDisk="false" timeToIdleSeconds="1200" timeToLiveSeconds="1200">
-	</defaultCache>
+<config xmlns="http://www.ehcache.org/v3"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.6.xsd">
+	
+	<!--
+		Cache configuration
+		===================
+		
+		The following attributes are required.
+		
+		name:
+			Sets the name of the cache. This is used to identify the cache. It must be unique.
+		
+		maxElementsInMemory:
+			Sets the maximum number of objects that will be created in memory
+		
+		maxElementsOnDisk:
+			Sets the maximum number of objects that will be maintained in the DiskStore
+			The default value is zero, meaning unlimited.
+		
+		eternal:
+			Sets whether elements are eternal. If eternal,  timeouts are ignored and the
+			element is never expired.
+		
+		overflowToDisk:
+			Sets whether elements can overflow to disk when the memory store
+			has reached the maxInMemory limit.
+		
+		The following attributes and elements are optional.
+		
+		timeToIdleSeconds:
+			Sets the time to idle for an element before it expires.
+			i.e. The maximum amount of time between accesses before an element expires
+			Is only used if the element is not eternal.
+			Optional attribute. A value of 0 means that an Element can idle for infinity.
+			The default value is 0.
+		
+		timeToLiveSeconds:
+			Sets the time to live for an element before it expires.
+			i.e. The maximum time between creation time and when an element expires.
+			Is only used if the element is not eternal.
+			Optional attribute. A value of 0 means that and Element can live for infinity.
+			The default value is 0.
+		
+		diskPersistent:
+			Whether the disk store persists between restarts of the Virtual Machine.
+			The default value is false.
+		
+		diskExpiryThreadIntervalSeconds:
+			The number of seconds between runs of the disk expiry thread. The default value
+			is 120 seconds.
+		
+		diskSpoolBufferSizeMB:
+			This is the size to allocate the DiskStore for a spool buffer. Writes are made
+			to this area and then asynchronously written to disk. The default size is 30MB.
+			Each spool buffer is used only by its cache. If you get OutOfMemory errors consider
+			lowering this value. To improve DiskStore performance consider increasing it. Trace level
+			logging in the DiskStore will show if put back ups are occurring.
+		
+		clearOnFlush:
+			whether the MemoryStore should be cleared when flush() is called on the cache.
+			By default, this is true i.e. the MemoryStore is cleared.
+		
+		memoryStoreEvictionPolicy:
+			Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+			policy is Least Recently Used (specified as LRU). Other policies available -
+			First In First Out (specified as FIFO) and Less Frequently Used
+			(specified as LFU)
+	-->
 
 	<!-- Sample cache named sampleCache1 This cache contains a maximum in memory 
 		of 10000 elements, and will expire an element if it is idle for more than 
@@ -103,44 +93,77 @@
 		elements it will overflow to the disk cache, which in this configuration 
 		will go to wherever java.io.tmp is defined on your system. On a standard 
 		Linux system this will be /tmp" -->
-		<!-- 
+	<!-- 
 		Note: set the 'overflowToDisk' flag always to 'true'.
 		The groups information is only read once during startup hence 
 		we need to retain this info forever available in the cache
 		as long as the server is running, so hinting the cache to store
 		on disk is needed to swap the data if it is too much to hold in memory -->
-	<cache name="groupCache" 
-	       maxElementsInMemory="10000"
-		   eternal="true" 
-		   overflowToDisk="true"
-		   diskSpoolBufferSizeMB="20"
-		   memoryStoreEvictionPolicy="LFU"
-		   diskPersistent="false" />
-    
-    <cache name="dnCache" 
-	       maxElementsInMemory="10000"
+	<cache alias="groupCache">
+		<key-type>java.lang.String</key-type>
+		<value-type>java.util.Set</value-type>
+		<expiry>
+			<ttl unit="seconds">1200</ttl>
+		</expiry>
+		<heap>10000</heap>
+		<heap-store-settings>
+			<max-object-size>10000</max-object-size>
+		</heap-store-settings>
+
+		<!-- unmigrated 2.x settings		   
+			eternal="true" 
+			overflowToDisk="true"
+			diskSpoolBufferSizeMB="20"
+			memoryStoreEvictionPolicy="LFU"
+			diskPersistent="false" />
+		-->
+	</cache>
+
+	<cache alias="dnCache">
+		<key-type>java.lang.String</key-type>
+		<value-type>org.apache.directory.api.ldap.model.name.Dn</value-type>
+		<expiry>
+			<ttl unit="seconds">600</ttl>
+		</expiry>
+		<heap>10000</heap>
+		<heap-store-settings>
+			<max-object-size>10000</max-object-size>
+		</heap-store-settings>
+		<!-- unmigrated 2.x settings
 		   eternal="false" 
 		   overflowToDisk="false"
 		   diskSpoolBufferSizeMB="20"
 		   timeToIdleSeconds="300"
 		   timeToLiveSeconds="600"
 		   memoryStoreEvictionPolicy="LFU" 
-		   diskPersistent="false" />
+		   diskPersistent="false" /> 
+		-->
+	</cache>
+	
+
+	<!-- Kerberos replay cache
+		NOTE1: keep the maxElementsInMemory as low as possible to avoid wasting memory
+		Cause the elements present in the cache won't be removed dynamically even after their TTL
+		expires. For a good explanation see http://forums.terracotta.org/forums/posts/list/4126.page
+		
+		NOTE2: We don't use the standard eviction policies like LFU or LRU rather we use a custom eviction
+			policy based on the value of clockskew setting. The default value of clokcskew is 5 minutes,
+			which is also set for the TTL and TTI values of cache config
+			
+		So what we do here is enable the overflowToDisk flag and then let the disk store be cleaned
+		periodically based on diskExpiryThreadIntervalSeconds
+	-->
+	<cache alias="kdcReplayCache">
+		<key-type>java.lang.String</key-type>
+		<expiry>
+			<ttl unit="seconds">600</ttl>
+		</expiry>
+		<heap>100</heap>
+		<heap-store-settings>
+			<max-object-size>100</max-object-size>
+		</heap-store-settings>
 
-   <!-- Kerberos replay cache
-      NOTE1: keep the maxElementsInMemory as low as possible to avoid wasting memory
-      Cause the elements present in the cache won't be removed dynamically even after their TTL
-      expires. For a good explanation see http://forums.terracotta.org/forums/posts/list/4126.page
-      
-      NOTE2: We don't use the standard eviction policies like LFU or LRU rather we use a custom eviction
-             policy based on the value of clockskew setting. The default value of clokcskew is 5 minutes,
-             which is also set for the TTL and TTI values of cache config
-             
-      So what we do here is enable the overflowToDisk flag and then let the disk store be cleaned
-      periodically based on diskExpiryThreadIntervalSeconds
-   -->
-    <cache name="kdcReplayCache" 
-	       maxElementsInMemory="100"
+		<!-- unmigrated 2.x settings
 		   eternal="false" 
 		   overflowToDisk="true"
 		   diskSpoolBufferSizeMB="20"
@@ -148,10 +171,21 @@
 		   timeToLiveSeconds="300"
 		   timeToIdleSeconds="300"
 		   diskPersistent="false" />
+		-->
+	</cache>
 
-   <!-- ChangePassword replay cache, this has the same settings as the Kerberos replay cache -->
-    <cache name="changePwdReplayCache" 
-	       maxElementsInMemory="100"
+	<!-- ChangePassword replay cache, this has the same settings as the Kerberos replay cache -->
+	<cache alias="changePwdReplayCache">
+		<key-type>java.lang.String</key-type>
+		<expiry>
+			<ttl unit="seconds">600</ttl>
+		</expiry>
+		<heap>100</heap>
+		<heap-store-settings>
+			<max-object-size>100</max-object-size>
+		</heap-store-settings>
+
+		<!-- unmigrated 2.x settings
 		   eternal="false" 
 		   overflowToDisk="true"
 		   diskSpoolBufferSizeMB="20"
@@ -159,14 +193,25 @@
 		   timeToLiveSeconds="300"
 		   timeToIdleSeconds="300"
 		   diskPersistent="false" />
-		   
-		   <!-- partition caches
-		     the name format:
-		     name="{partition-suffix}" for partition
-		     name="{partition-suffix}:{index name/OID}" for each partition's index (currently only RDN index supports cache)
-		    -->
-	<cache name="ou=system" 
-	       maxElementsInMemory="1000"
+		-->
+	</cache>
+
+	<!-- partition caches
+		the name format:
+		name="{partition-suffix}" for partition
+		name="{partition-suffix}:{index name/OID}" for each partition's index (currently only RDN index supports cache)
+	-->
+	<cache alias="ou=system">
+		<key-type>java.lang.String</key-type>
+		<expiry>
+			<ttl unit="seconds">600</ttl>
+		</expiry>
+		<heap>1000</heap>
+		<heap-store-settings>
+			<max-object-size>1000</max-object-size>
+		</heap-store-settings>
+		
+		<!-- unmigrated 2.x settings
 		   eternal="false" 
 		   overflowToDisk="true"
 		   diskSpoolBufferSizeMB="20"
@@ -174,15 +219,50 @@
 		   timeToLiveSeconds="600"
 		   memoryStoreEvictionPolicy="LFU"
 		   diskPersistent="false"/>
-		   
-	<cache name="ou=system:apacheRdn" 
-	       maxElementsInMemory="10000"
+		-->
+	</cache>
+	
+	<cache alias="ou=system:apacheRdn">
+		<key-type>java.lang.String</key-type>
+		<expiry>
+			<ttl unit="seconds">600</ttl>
+		</expiry>
+		<heap>10000</heap>
+		<heap-store-settings>
+			<max-object-size>10000</max-object-size>
+		</heap-store-settings>
+		
+		<!-- unmigrated 2.x settings
 		   eternal="false" 
 		   overflowToDisk="false"
 		   timeToIdleSeconds="300"
 		   timeToLiveSeconds="600"
 		   memoryStoreEvictionPolicy="LFU"
 		   diskPersistent="false"/>
-		   
-		   
-</ehcache>
\ No newline at end of file
+		-->
+	</cache>
+ 
+	<cache alias="alias">
+		<key-type>java.lang.String</key-type>
+		<value-type>org.apache.directory.api.ldap.model.name.Dn</value-type>
+		<expiry>
+			<ttl unit="seconds">1200</ttl>
+		</expiry>
+		<heap>1000</heap>
+		<heap-store-settings>
+			<max-object-size>1000</max-object-size>
+		</heap-store-settings>
+	</cache>
+
+	<cache alias="entryDn">
+		<key-type>java.lang.String</key-type>
+		<value-type>org.apache.directory.api.ldap.model.name.Dn</value-type>
+		<expiry>
+			<ttl unit="seconds">1200</ttl>
+		</expiry>
+		<heap>1000</heap>
+		<heap-store-settings>
+			<max-object-size>1000</max-object-size>
+		</heap-store-settings>
+	</cache>
+</config>
\ No newline at end of file
diff --git a/core-integ/src/test/resources/log4j.properties b/core-integ/src/test/resources/log4j.properties
index 5d3dd4c..60555c6 100644
--- a/core-integ/src/test/resources/log4j.properties
+++ b/core-integ/src/test/resources/log4j.properties
@@ -38,7 +38,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
 log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
 log4j.logger.org.apache.directory.api=FATAL
 log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
 log4j.logger.org.apache.mina=FATAL
 log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
 log4j.logger.org.apache.directory.api.ldap.model.ldif=FATAL
diff --git a/core-shared/pom.xml b/core-shared/pom.xml
index 9e8c303..7d1ca28 100644
--- a/core-shared/pom.xml
+++ b/core-shared/pom.xml
@@ -78,7 +78,7 @@
     </dependency>
     
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
 
@@ -147,7 +147,7 @@
                 jdbm.btree,
                 jdbm.helper,
                 jdbm.recman,
-                net.sf.ehcache;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
                 org.apache.directory.api.ldap.codec.api;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.extras.controls.syncrepl.syncState;version=${org.apache.directory.api.version},
diff --git a/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java b/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
index 606e409..af896fd 100644
--- a/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
+++ b/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
@@ -21,8 +21,7 @@
 package org.apache.directory.server.core.shared;
 
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
+import org.ehcache.Cache;
 
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.name.Dn;
@@ -42,7 +41,7 @@ public class DefaultDnFactory implements DnFactory
     private static final Logger LOG = LoggerFactory.getLogger( DefaultDnFactory.class );
 
     /** The cache for DNs */
-    private Cache dnCache;
+    private Cache<String, Dn> dnCache;
 
     /** The schema manager */
     private SchemaManager schemaManager;
@@ -61,7 +60,7 @@ public class DefaultDnFactory implements DnFactory
      * @param schemaManager The SchemaManager instance
      * @param dnCache The cache used to store DNs
      */
-    public DefaultDnFactory( SchemaManager schemaManager, Cache dnCache )
+    public DefaultDnFactory( SchemaManager schemaManager, Cache<String, Dn> dnCache )
     {
         this.schemaManager = schemaManager;
         this.dnCache = dnCache;
@@ -90,12 +89,7 @@ public class DefaultDnFactory implements DnFactory
         // for the reason for performing this check
         if ( dnCache != null )
         {
-            Element dnCacheEntry = dnCache.get( dn );
-
-            if ( dnCacheEntry != null )
-            {
-                cachedDn = ( Dn ) dnCacheEntry.getObjectValue();
-            }
+            cachedDn = dnCache.get( dn );
         }
 
         if ( cachedDn == null )
@@ -106,7 +100,7 @@ public class DefaultDnFactory implements DnFactory
 
             if ( dnCache != null )
             {
-                dnCache.put( new Element( dn, cachedDn ) );
+                dnCache.put( dn, cachedDn );
             }
 
             if ( enableStats )
diff --git a/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java b/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
index 7ded3e7..a8a965f 100644
--- a/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
+++ b/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
@@ -202,9 +202,6 @@ public class DefaultDirectoryService implements DirectoryService
     /** The default delay to wait between sync on disk : 15 seconds */
     private static final long DEFAULT_SYNC_PERIOD = 15000;
 
-    /** */
-    private Thread workerThread;
-
     /** The default timeLimit : 100 entries */
     public static final int MAX_SIZE_LIMIT_DEFAULT = 100;
 
@@ -1966,7 +1963,8 @@ public class DefaultDirectoryService implements DirectoryService
 
         if ( dnFactory == null )
         {
-            dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+            dnFactory = new DefaultDnFactory( schemaManager, 
+                cacheService.getCache( "dnCache", String.class, Dn.class ) );
         }
 
         // triggers partition to load schema fully from schema partition
diff --git a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
index bf48987..ccf5dae 100644
--- a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
+++ b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
@@ -38,6 +38,6 @@ log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 #log4j.logger.org.apache.directory.CURSOR_LOG=DEBUG
 #log4j.logger.org.apache.directory.api=DEBUG
 #log4j.logger.org.apache.directory.server=DEBUG
-#log4j.logger.net.sf.ehcache=DEBUG
+#log4j.logger.org.ehcache=DEBUG
 #log4j.logger.org.apache.mina=DEBUG
 
diff --git a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
index 253dfbd..28bad8b 100644
--- a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
+++ b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
@@ -42,6 +42,6 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=WARN
 log4j.logger.org.apache.directory.CURSOR_LOG=WARN
 log4j.logger.org.apache.directory.api=WARN
 log4j.logger.org.apache.directory.server=WARN
-log4j.logger.net.sf.ehcache=WARN
+log4j.logger.org.ehcache=WARN
 log4j.logger.org.apache.mina=WARN
 
diff --git a/interceptors/authz/pom.xml b/interceptors/authz/pom.xml
index fd060b9..48fd893 100644
--- a/interceptors/authz/pom.xml
+++ b/interceptors/authz/pom.xml
@@ -73,7 +73,7 @@
     </dependency>
     
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
   </dependencies>
@@ -130,7 +130,7 @@
             </Export-Package>
             <Import-Package>
                 javax.naming.directory,
-                net.sf.ehcache;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
                 org.apache.directory.api.ldap.aci;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.aci.protectedItem;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
diff --git a/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java b/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
index 1564c72..31cc443 100644
--- a/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
+++ b/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
@@ -21,13 +21,13 @@ package org.apache.directory.server.core.authz;
 
 
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
 import javax.naming.directory.SearchControls;
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
+import org.ehcache.Cache;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Attribute;
@@ -45,6 +45,7 @@ import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.api.CacheService;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.DnFactory;
@@ -93,7 +94,7 @@ public class GroupCache
     private static final Set<String> EMPTY_GROUPS = new HashSet<>();
 
     /** String key for the Dn of a group to a Set (HashSet) for the Strings of member DNs */
-    private Cache groupCache;
+    private Cache< String, Set > groupCache;
 
 
 
@@ -113,7 +114,7 @@ public class GroupCache
         // stuff for dealing with the admin group
         administratorsGroupDn = parseNormalized( ServerDNConstants.ADMINISTRATORS_GROUP_DN );
 
-        groupCache = dirService.getCacheService().getCache( "groupCache" );
+        groupCache = dirService.getCacheService().getCache( "groupCache", String.class, Set.class );
 
         initialize( dirService.getAdminSession() );
     }
@@ -178,8 +179,7 @@ public class GroupCache
                         Set<String> memberSet = new HashSet<>( members.size() );
                         addMembers( memberSet, members );
 
-                        Element cacheElement = new Element( groupDn.getNormName(), memberSet );
-                        groupCache.put( cacheElement );
+                        groupCache.put( groupDn.getNormName(), memberSet );
                     }
                     else
                     {
@@ -200,7 +200,8 @@ public class GroupCache
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "group cache contents on startup:\n {}", groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+            LOG.debug( "group cache contents on startup:\n {}", 
+                CacheService.dumpCacheContentsToString( groupCache ) );
         }
     }
 
@@ -313,13 +314,12 @@ public class GroupCache
         Set<String> memberSet = new HashSet<>( members.size() );
         addMembers( memberSet, members );
 
-        Element cacheElement = new Element( name, memberSet );
-        groupCache.put( cacheElement );
+        groupCache.put( name, memberSet );
 
         if ( IS_DEBUG )
         {
             LOG.debug( "group cache contents after adding '{}' :\n {}", name,
-                groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+                CacheService.dumpCacheContentsToString( groupCache ) );
         }
     }
 
@@ -346,7 +346,7 @@ public class GroupCache
         if ( IS_DEBUG )
         {
             LOG.debug( "group cache contents after deleting '{}' :\n {}", name.getName(),
-                groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+                CacheService.dumpCacheContentsToString( groupCache ) );
         }
     }
 
@@ -427,11 +427,10 @@ public class GroupCache
         {
             if ( memberAttr.getOid() == modification.getAttribute().getId() )
             {
-                Element memSetElement = groupCache.get( name.getNormName() );
-
-                if ( memSetElement != null )
+                Set<String> memberSet = groupCache.get( name.getNormName() );
+                
+                if ( memberSet != null )
                 {
-                    Set<String> memberSet = ( Set<String> ) memSetElement.getObjectValue();
                     modify( memberSet, modification.getOperation(), modification.getAttribute() );
                 }
 
@@ -442,7 +441,7 @@ public class GroupCache
         if ( IS_DEBUG )
         {
             LOG.debug( "group cache contents after modifying '{}' :\n {}", name.getName(),
-                groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+                CacheService.dumpCacheContentsToString( groupCache ) );
         }
     }
 
@@ -465,18 +464,17 @@ public class GroupCache
             return;
         }
 
-        Element memSetElement = groupCache.get( name.getNormName() );
+        Set<String> memberSet = groupCache.get( name.getNormName() );
 
-        if ( memSetElement != null )
+        if ( memberSet != null )
         {
-            Set<String> memberSet = ( Set<String> ) memSetElement.getObjectValue();
             modify( memberSet, modOp, members );
         }
 
         if ( IS_DEBUG )
         {
             LOG.debug( "group cache contents after modifying '{}' :\n {}", name.getName(),
-                groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+                CacheService.dumpCacheContentsToString( groupCache ) );
         }
     }
 
@@ -495,17 +493,15 @@ public class GroupCache
             return true;
         }
 
-        Element cacheElement = groupCache.get( administratorsGroupDn.getNormName() );
-
-        if ( cacheElement == null )
+        Set<String> members = groupCache.get( administratorsGroupDn.getNormName() );
+        
+        if ( members == null )
         {
             LOG.warn( "What do you mean there is no administrators group? This is bad news." );
             return false;
         }
         else
         {
-            Set<String> members = ( Set<String> ) cacheElement.getObjectValue();
-            
             return members.contains( principalDn );
         }
     }
@@ -523,17 +519,12 @@ public class GroupCache
     {
         Set<String> memberGroups = null;
 
-        for ( Object obj : groupCache.getKeys() )
+        Iterator<Cache.Entry<String, Set>> iterator = groupCache.iterator();
+        while ( iterator.hasNext() )
         {
-            String group = ( String ) obj;
-            Element element = groupCache.get( group );
-
-            if ( element == null )
-            {
-                continue;
-            }
-
-            Set<String> members = ( Set<String> ) element.getObjectValue();
+            Cache.Entry<String, Set> next = iterator.next();
+            String group = next.getKey();
+            Set<String> members = next.getValue();
 
             if ( members == null )
             {
@@ -562,21 +553,18 @@ public class GroupCache
 
     public boolean groupRenamed( Dn oldName, Dn newName )
     {
-        Element membersElement = groupCache.get( oldName.getNormName() );
+        Set<String> members = groupCache.get( oldName.getNormName() );
 
-        if ( membersElement != null )
+        if ( members != null )
         {
-            Set<String> members = ( Set<String> ) membersElement.getObjectValue();
-
             groupCache.remove( oldName.getNormName() );
 
-            Element cacheElement = new Element( newName, members );
-            groupCache.put( cacheElement );
+            groupCache.put( newName.getNormName(), members );
 
             if ( IS_DEBUG )
             {
                 LOG.debug( "group cache contents after renaming '{}' :\n{}", oldName.getName(),
-                    groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+                    CacheService.dumpCacheContentsToString( groupCache ) );
             }
 
             return true;
diff --git a/interceptors/hash/pom.xml b/interceptors/hash/pom.xml
index 802b152..46243eb 100644
--- a/interceptors/hash/pom.xml
+++ b/interceptors/hash/pom.xml
@@ -120,16 +120,6 @@
       <artifactId>api-ldap-schema-data</artifactId>
     </dependency>
     
-    <!--dependency>
-      <groupId>org.apache.directory.api</groupId>
-      <artifactId>api-util</artifactId>
-    </dependency-->
-    
-    <dependency>
-      <groupId>net.sf.ehcache</groupId>
-      <artifactId>ehcache</artifactId>
-    </dependency>
-
     <dependency>
       <groupId>org.apache.directory.api</groupId>
       <artifactId>api-ldap-extras-codec</artifactId>
diff --git a/interceptors/logger/pom.xml b/interceptors/logger/pom.xml
index cf881f9..d71f3d7 100644
--- a/interceptors/logger/pom.xml
+++ b/interceptors/logger/pom.xml
@@ -111,11 +111,6 @@
     </dependency>
     
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
-      <artifactId>ehcache</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.directory.api</groupId>
       <artifactId>api-ldap-extras-codec</artifactId>
       <scope>provided</scope>
diff --git a/interceptors/subtree/pom.xml b/interceptors/subtree/pom.xml
index 18a418b..e822e71 100644
--- a/interceptors/subtree/pom.xml
+++ b/interceptors/subtree/pom.xml
@@ -78,7 +78,7 @@
     </dependency>
     
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
   </dependencies>
@@ -134,6 +134,8 @@
             </Export-Package>
             <Import-Package>
                 javax.naming.directory,
+                org.ehcache;version=${ehcache.version},
+                org.ehcache.config.builders;version=${ehcache.version},
                 org.apache.directory.api.ldap.codec.controls.search.subentries;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.entry;version=${org.apache.directory.api.version},
diff --git a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
index 613f630..ad384f5 100644
--- a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
+++ b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
@@ -28,9 +28,6 @@ import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.filter.ExprNode;
@@ -49,6 +46,11 @@ import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
 import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
 import org.apache.directory.server.core.shared.DefaultDnFactory;
+import org.ehcache.Cache;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -72,6 +74,7 @@ public class SubtreeEvaluatorTest
     private static SubtreeEvaluator evaluator;
     private static FilterNormalizingVisitor visitor;
     private static ConcreteNameComponentNormalizer ncn;
+    private static Cache<String, Dn> dnCache;
 
 
     @BeforeClass
@@ -99,9 +102,9 @@ public class SubtreeEvaluatorTest
             fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
 
-        CacheManager.getInstance().addCacheIfAbsent( "dnCache" );
-        Cache dnCache = CacheManager.getInstance().getCache( "dnCache" );
-        dnFactory = new DefaultDnFactory( schemaManager, dnCache );
+        CacheManager cm = CacheManagerBuilder.newCacheManagerBuilder().withCache( "dnCache", CacheConfigurationBuilder.newCacheConfigurationBuilder( String.class, Dn.class, ResourcePoolsBuilder.heap(1000)).build()).build();
+        cm.init();
+        dnCache = cm.getCache( "dnCache", String.class, Dn.class );        dnFactory = new DefaultDnFactory( schemaManager, dnCache );
 
         ncn = new ConcreteNameComponentNormalizer( schemaManager );
 
@@ -115,7 +118,7 @@ public class SubtreeEvaluatorTest
     {
         visitor = null;
         evaluator = null;
-        CacheManager.getInstance().getCache( "dnCache" ).removeAll();
+        dnCache.clear();
     }
 
 
diff --git a/jdbm-partition/pom.xml b/jdbm-partition/pom.xml
index 737c3ac..21c35ce 100644
--- a/jdbm-partition/pom.xml
+++ b/jdbm-partition/pom.xml
@@ -150,8 +150,7 @@
                 jdbm.btree,
                 jdbm.helper,
                 jdbm.recman,
-                net.sf.ehcache;version=${ehcache.version},
-                net.sf.ehcache.config;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
                 org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.csn;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.cursor;version=${org.apache.directory.api.version},
diff --git a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
index f0e9418..26533c7 100644
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
@@ -29,14 +29,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.UUID;
 
-import jdbm.RecordManager;
-import jdbm.helper.MRU;
-import jdbm.recman.BaseRecordManager;
-import jdbm.recman.CacheRecordManager;
-import jdbm.recman.TransactionManager;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.csn.CsnFactory;
 import org.apache.directory.api.ldap.model.cursor.Cursor;
@@ -78,9 +70,16 @@ import org.apache.directory.server.xdbm.search.impl.DefaultOptimizer;
 import org.apache.directory.server.xdbm.search.impl.DefaultSearchEngine;
 import org.apache.directory.server.xdbm.search.impl.EvaluatorBuilder;
 import org.apache.directory.server.xdbm.search.impl.NoOpOptimizer;
+import org.ehcache.Cache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import jdbm.RecordManager;
+import jdbm.helper.MRU;
+import jdbm.recman.BaseRecordManager;
+import jdbm.recman.CacheRecordManager;
+import jdbm.recman.TransactionManager;
+
 
 /**
  * A {@link Partition} that stores entries in
@@ -109,7 +108,7 @@ public class JdbmPartition extends AbstractBTreePartition
     private RecordManager recMan;
 
     /** the entry cache */
-    private Cache entryCache;
+    private Cache< String, Entry > entryCache;
 
 
     /**
@@ -536,14 +535,14 @@ public class JdbmPartition extends AbstractBTreePartition
 
             if ( cacheService != null )
             {
-                entryCache = cacheService.getCache( getId() );
+                entryCache = cacheService.getCache( getId(), String.class, Entry.class );
 
-                int cacheSizeConfig = ( int ) entryCache.getCacheConfiguration().getMaxEntriesLocalHeap();
+                //int cacheSizeConfig = ( int ) entryCache.getCacheConfiguration().getMaxEntriesLocalHeap();
 
-                if ( cacheSizeConfig < cacheSize )
-                {
-                    entryCache.getCacheConfiguration().setMaxEntriesLocalHeap( cacheSize );
-                }
+                //if ( cacheSizeConfig < cacheSize )
+                //{
+                //    entryCache.getCacheConfiguration().setMaxEntriesLocalHeap( cacheSize );
+                //}
             }
 
             // Initialization of the context entry
@@ -885,7 +884,7 @@ public class JdbmPartition extends AbstractBTreePartition
         {
             if ( entryCache != null )
             {
-                entryCache.removeAll();
+                entryCache.clear();
             }
         }
 
@@ -952,14 +951,14 @@ public class JdbmPartition extends AbstractBTreePartition
                     entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
                 }
 
-                entryCache.replace( new Element( id, entry ) );
+                entryCache.replace( id, entry );
             }
             else if ( ( opCtx instanceof MoveOperationContext )
                 || ( opCtx instanceof MoveAndRenameOperationContext )
                 || ( opCtx instanceof RenameOperationContext ) )
             {
                 // clear the cache it is not worth updating all the children
-                entryCache.removeAll();
+                entryCache.clear();
             }
             else if ( opCtx instanceof DeleteOperationContext )
             {
@@ -978,19 +977,7 @@ public class JdbmPartition extends AbstractBTreePartition
     @Override
     public Entry lookupCache( String id )
     {
-        if ( entryCache == null )
-        {
-            return null;
-        }
-
-        Element el = entryCache.get( id );
-
-        if ( el != null )
-        {
-            return ( Entry ) el.getObjectValue();
-        }
-
-        return null;
+        return ( entryCache != null ) ? entryCache.get( id ) : null;
     }
 
 
@@ -1009,7 +996,7 @@ public class JdbmPartition extends AbstractBTreePartition
             addedEntry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
         }
 
-        entryCache.put( new Element( id, addedEntry ) );
+        entryCache.put( id, addedEntry );
     }
 
 
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
index 87021a5..fcdd992 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
@@ -154,7 +154,8 @@ public class JdbmStoreTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
index ef0407b..88e4eed 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
@@ -86,7 +86,8 @@ public class PartitionTreeTest
 
         CacheService cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/kerberos-codec/pom.xml b/kerberos-codec/pom.xml
index 8599ba4..918e1aa 100644
--- a/kerberos-codec/pom.xml
+++ b/kerberos-codec/pom.xml
@@ -69,7 +69,7 @@
     </dependency>
     
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
   </dependencies>
@@ -134,8 +134,7 @@
                 javax.crypto,
                 javax.crypto.spec,
                 javax.security.auth.kerberos,
-                net.sf.ehcache;version=${ehcache.version},
-                net.sf.ehcache.store;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
                 org.apache.directory.api.asn1;version=${org.apache.directory.api.version},
                 org.apache.directory.api.asn1.actions;version=${org.apache.directory.api.version},
                 org.apache.directory.api.asn1.ber;version=${org.apache.directory.api.version},
diff --git a/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java b/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
index a4c4c59..58aa5a0 100644
--- a/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
+++ b/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
@@ -24,12 +24,8 @@ import java.io.Serializable;
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.store.AbstractPolicy;
-
 import org.apache.directory.shared.kerberos.KerberosTime;
+import org.ehcache.Cache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,7 +45,7 @@ public class ReplayCacheImpl implements ReplayCache
     private static final Logger LOG = LoggerFactory.getLogger( ReplayCacheImpl.class );
 
     /** ehcache based storage to store the entries */
-    private Cache cache;
+    private Cache< String, Object > cache;
 
     /** default clock skew */
     private static final long DEFAULT_CLOCK_SKEW = 5L * KerberosTime.MINUTE;
@@ -140,41 +136,14 @@ public class ReplayCacheImpl implements ReplayCache
         }
     }
 
-    /**
-     * an expiration policy based on the clockskew
-     */
-    private class ClockskewExpirationPolicy extends AbstractPolicy
-    {
-
-        /**
-         * {@inheritDoc}
-         */
-        public String getName()
-        {
-            return "CLOCK-SKEW";
-        }
-
-
-        /**
-         * {@inheritDoc}
-         */
-        public boolean compare( Element element1, Element element2 )
-        {
-            ReplayCacheEntry entry = ( ReplayCacheEntry ) element2.getObjectValue();
-
-            return entry.isOutsideClockSkew( clockSkew );
-        }
-    }
-
 
     /**
      * Creates a new instance of InMemoryReplayCache. Sets the
      * delay between each cleaning run to 5 seconds.
      */
-    public ReplayCacheImpl( Cache cache )
+    public ReplayCacheImpl( Cache < String, Object > cache )
     {
         this.cache = cache;
-        this.cache.setMemoryStoreEvictionPolicy( new ClockskewExpirationPolicy() );
     }
 
 
@@ -185,11 +154,10 @@ public class ReplayCacheImpl implements ReplayCache
      * 
      * @param clockSkew the allowed skew (milliseconds)
      */
-    public ReplayCacheImpl( Cache cache, long clockSkew )
+    public ReplayCacheImpl( Cache< String, Object > cache, long clockSkew )
     {
         this.cache = cache;
         this.clockSkew = clockSkew;
-        this.cache.setMemoryStoreEvictionPolicy( new ClockskewExpirationPolicy() );
     }
 
 
@@ -210,17 +178,16 @@ public class ReplayCacheImpl implements ReplayCache
     public synchronized boolean isReplay( KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal,
         KerberosTime clientTime, int clientMicroSeconds )
     {
+        ReplayCacheEntry entry = new ReplayCacheEntry( serverPrincipal, 
+            clientPrincipal, clientTime, clientMicroSeconds );
+        ReplayCacheEntry found = ( ReplayCacheEntry ) cache.get( entry.createKey() );
 
-        ReplayCacheEntry entry = new ReplayCacheEntry( serverPrincipal, clientPrincipal, clientTime, clientMicroSeconds );
-
-        Element element = cache.get( entry.createKey() );
-
-        if ( element == null )
+        if ( found == null )
         {
             return false;
         }
 
-        entry = ( ReplayCacheEntry ) element.getObjectValue();
+        entry = found;
 
         return serverPrincipal.equals( entry.serverPrincipal ) &&
             clientTime.equals( entry.clientTime ) &&
@@ -237,8 +204,7 @@ public class ReplayCacheImpl implements ReplayCache
     {
         ReplayCacheEntry entry = new ReplayCacheEntry( serverPrincipal, clientPrincipal, clientTime, clientMicroSeconds );
 
-        Element element = new Element( entry.createKey(), entry );
-        cache.put( element );
+        cache.put( entry.createKey(), entry );
     }
 
 
@@ -248,8 +214,6 @@ public class ReplayCacheImpl implements ReplayCache
     public void clear()
     {
         LOG.debug( "removing all the elements from cache" );
-        if (cache.getStatus().equals(Status.STATUS_ALIVE)) {
-            cache.removeAll();
-        }
+        cache.clear();
     }
 }
diff --git a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
index 33d6c2e..1de75b1 100644
--- a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
+++ b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
@@ -20,20 +20,29 @@
 package org.apache.directory.server.kerberos.shared.replay;
 
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-
 import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.types.PrincipalNameType;
+import org.ehcache.Cache;
+import org.ehcache.Cache.Entry;
+import org.ehcache.CacheManager;
+import org.ehcache.Status;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.ehcache.config.builders.ExpiryPolicyBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -70,15 +79,24 @@ public class ReplayCacheImplTest
         {
             long clockSkew = 1000; // 1 sec
 
-            cacheManager = new CacheManager();
-
-            cacheManager.addCache( "kdcReplayCache" );
-            Cache ehCache = cacheManager.getCache( "kdcReplayCache" );
-            ehCache.getCacheConfiguration().setMaxElementsInMemory( 4 );
-            ehCache.getCacheConfiguration().setTimeToLiveSeconds( 1 );
-            ehCache.getCacheConfiguration().setTimeToIdleSeconds( 1 );
-            ehCache.getCacheConfiguration().setDiskExpiryThreadIntervalSeconds( 1 );
-
+            cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build();
+            
+            cacheManager.init();
+
+            Cache< String, Object > ehCache = cacheManager.createCache( 
+                    "kdcReplayCache", 
+                    CacheConfigurationBuilder.newCacheConfigurationBuilder(
+                            String.class, 
+                            Object.class, 
+                            ResourcePoolsBuilder.heap(4)
+                    )
+                        .withExpiry(
+                            ExpiryPolicyBuilder
+                                .timeToIdleExpiration( Duration.ofMillis( 1000 ) )
+                                )
+                        .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration( Duration.ofMillis( 1000 )))
+            );
+            
             ReplayCacheImpl cache = new ReplayCacheImpl( ehCache, clockSkew );
 
             int i = 0;
@@ -96,7 +114,13 @@ public class ReplayCacheImplTest
                 i++;
             }
 
-            List<?> keys = ehCache.getKeys();
+            List<String> keys = new ArrayList<>();
+            Iterator<Entry<String, Object>> it = ehCache.iterator();
+            
+            while (it.hasNext())
+            {
+                keys.add(it.next().getKey());
+            }
 
             // We should have 4 entries
             assertTrue( keys.size() != 0 );
@@ -105,18 +129,18 @@ public class ReplayCacheImplTest
             Thread.sleep( 1200 );
 
             // then access the cache so that the objects present in the cache will be expired
-            for ( Object k : keys )
+            for ( String k : keys )
             {
                 assertNull( ehCache.get( k ) );
             }
 
-            assertEquals( 0, ehCache.getKeys().size() );
+            assertFalse( ehCache.iterator().hasNext() );
         }
         finally
         {
-            if ( cacheManager != null )
+            if ( cacheManager != null && cacheManager.getStatus() != Status.UNINITIALIZED)
             {
-                cacheManager.shutdown();
+                cacheManager.close();
             }
         }
     }
diff --git a/ldap-client-test/src/test/resources/log4j.properties b/ldap-client-test/src/test/resources/log4j.properties
index 1114873..00cf0b4 100644
--- a/ldap-client-test/src/test/resources/log4j.properties
+++ b/ldap-client-test/src/test/resources/log4j.properties
@@ -31,7 +31,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
 log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
 log4j.logger.org.apache.directory.api=FATAL
 log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
 log4j.logger.org.apache.mina=FATAL
 log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
 log4j.logger.org.apache.directory.ldap.client.api=FATAL
\ No newline at end of file
diff --git a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
index 6d7eb9e..0952bc5 100644
--- a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
+++ b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
@@ -134,7 +134,8 @@ public class LdifPartitionTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
index 3189463..aeabfb7 100644
--- a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
+++ b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
@@ -178,7 +178,8 @@ public class SingleFileLdifPartitionSingeValueAttribute
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
index 28c1353..551a2e6 100644
--- a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
+++ b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
@@ -176,7 +176,8 @@ public class SingleFileLdifPartitionTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/mavibot-partition/pom.xml b/mavibot-partition/pom.xml
index fb60213..ea03943 100644
--- a/mavibot-partition/pom.xml
+++ b/mavibot-partition/pom.xml
@@ -133,7 +133,7 @@
                 org.apache.directory.server.core.partition.impl.btree.mavibot;version=${project.version}
             </Export-Package>
             <Import-Package>
-                net.sf.ehcache;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
                 org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.cursor;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.entry;version=${org.apache.directory.api.version},
diff --git a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
index 3240429..da7a18f 100644
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
@@ -30,9 +30,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
+import org.ehcache.Cache;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.Cursor;
 import org.apache.directory.api.ldap.model.cursor.Tuple;
@@ -95,7 +93,7 @@ public class MavibotPartition extends AbstractBTreePartition
     private RecordManager recordMan;
 
     /** the entry cache */
-    private Cache entryCache;
+    private Cache< String, Entry > entryCache;
 
 
     public MavibotPartition( SchemaManager schemaManager, DnFactory dnFactory )
@@ -175,12 +173,9 @@ public class MavibotPartition extends AbstractBTreePartition
 
             // First, check if the file storing the data exists
 
-            // Create the master table (the table containing all the entries)
-            Cache masterTableCache = cacheService.getCache( suffixDn.getName() );
-            
             try
             {
-                master = new MavibotMasterTable( recordMan, schemaManager, "master", masterTableCache.getCacheConfiguration().getMaxElementsInMemory() );
+                master = new MavibotMasterTable( recordMan, schemaManager, "master", cacheSize );
             }
             catch ( IOException ioe )
             {
@@ -234,14 +229,7 @@ public class MavibotPartition extends AbstractBTreePartition
 
             if ( cacheService != null )
             {
-                entryCache = cacheService.getCache( getId() );
-                
-                int cacheSizeConfig = entryCache.getCacheConfiguration().getMaxElementsInMemory();
-
-                if ( cacheSizeConfig < cacheSize )
-                {
-                    entryCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize );
-                }
+                entryCache = cacheService.getCache( getId(), String.class, Entry.class );
             }
 
             // We are done !
@@ -333,7 +321,7 @@ public class MavibotPartition extends AbstractBTreePartition
         {
             if ( entryCache != null )
             {
-                entryCache.removeAll();
+                entryCache.clear();
             }
         }
 
@@ -457,19 +445,7 @@ public class MavibotPartition extends AbstractBTreePartition
     @Override
     public Entry lookupCache( String id )
     {
-        if ( entryCache == null )
-        {
-            return null;
-        }
-
-        Element el = entryCache.get( id );
-
-        if ( el != null )
-        {
-            return ( Entry ) el.getObjectValue();
-        }
-
-        return null;
+        return ( entryCache != null ) ? entryCache.get( id ) : null;
     }
 
 
@@ -486,7 +462,7 @@ public class MavibotPartition extends AbstractBTreePartition
             entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
         }
 
-        entryCache.put( new Element( id, entry ) );
+        entryCache.put( id, entry );
     }
 
 
@@ -512,13 +488,13 @@ public class MavibotPartition extends AbstractBTreePartition
                     entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
                 }
 
-                entryCache.replace( new Element( id, entry ) );
+                entryCache.replace( id, entry );
             }
             else if ( ( opCtx instanceof MoveOperationContext ) || ( opCtx instanceof MoveAndRenameOperationContext )
                 || ( opCtx instanceof RenameOperationContext ) )
             {
                 // clear the cache it is not worth updating all the children
-                entryCache.removeAll();
+                entryCache.clear();
             }
             else if ( opCtx instanceof DeleteOperationContext )
             {
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
index a74426d..69406bf 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
@@ -162,7 +162,8 @@ public class MavibotStoreTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/non-osgi-dependencies/pom.xml b/non-osgi-dependencies/pom.xml
index 1199935..d1d03ce 100644
--- a/non-osgi-dependencies/pom.xml
+++ b/non-osgi-dependencies/pom.xml
@@ -33,7 +33,7 @@
 
   <dependencies>
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache-core</artifactId>
       <version>${ehcache.version}</version>
     </dependency>
@@ -70,7 +70,7 @@
               *
             </Import-Package>
             <_exportcontents>
-              net.sf.ehcache*,
+              org.ehcache*,
               org.bouncycastle*,
               org.junit*
             </_exportcontents>
diff --git a/pom.xml b/pom.xml
index 9fa7256..93e9f4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@
     <commons.net.version>3.6</commons.net.version>
     <commons.pool.version>2.6.0</commons.pool.version>
     <dnsjava.version>2.1.8</dnsjava.version>
-    <ehcache.version>2.10.4</ehcache.version>
+    <ehcache.version>3.6.1</ehcache.version>
     <findbugs.annotations.version>1.0.0</findbugs.annotations.version>
     <jetty.version>9.4.5.v20170502</jetty.version>
     <!-- The Jetty bundle exports are using version 9.4.5, not 9.4.5.v20170502... -->
@@ -1239,7 +1239,7 @@
       </dependency>
       
       <dependency>
-        <groupId>net.sf.ehcache</groupId>
+        <groupId>org.ehcache</groupId>
         <artifactId>ehcache</artifactId>
         <version>${ehcache.version}</version>
       </dependency>
diff --git a/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java b/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
index 7891807..348d114 100644
--- a/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
+++ b/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
@@ -26,7 +26,7 @@ import java.util.List;
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import net.sf.ehcache.Cache;
+import org.ehcache.Cache;
 
 import org.apache.directory.server.changepw.protocol.ChangePasswordProtocolHandler;
 import org.apache.directory.server.constants.ServerDNConstants;
diff --git a/protocol-kerberos/pom.xml b/protocol-kerberos/pom.xml
index b81a237..aed97c0 100644
--- a/protocol-kerberos/pom.xml
+++ b/protocol-kerberos/pom.xml
@@ -73,7 +73,7 @@
     </dependency>
 
     <dependency>
-      <groupId>net.sf.ehcache</groupId>
+      <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
   </dependencies>
@@ -139,7 +139,7 @@
                 javax.naming,
                 javax.naming.directory,
                 javax.security.auth.kerberos,
-                net.sf.ehcache;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
                 org.apache.directory.api.asn1;version=${org.apache.directory.api.version},
                 org.apache.directory.api.asn1.ber;version=${org.apache.directory.api.version},
                 org.apache.directory.api.asn1.ber.tlv;version=${org.apache.directory.api.version},
diff --git a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
index 05ff750..b9b9b90 100644
--- a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
+++ b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
@@ -22,8 +22,6 @@ package org.apache.directory.server.kerberos.changepwd;
 
 import java.io.IOException;
 
-import net.sf.ehcache.Cache;
-
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.server.kerberos.ChangePasswordConfig;
@@ -39,6 +37,7 @@ import org.apache.directory.server.protocol.shared.transport.UdpTransport;
 import org.apache.mina.core.service.IoAcceptor;
 import org.apache.mina.transport.socket.DatagramSessionConfig;
 import org.apache.mina.transport.socket.SocketAcceptor;
+import org.ehcache.Cache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -95,7 +94,8 @@ public class ChangePasswordServer extends DirectoryBackedService
 
         LOG.debug( "initializing the changepassword replay cache" );
 
-        Cache cache = getDirectoryService().getCacheService().getCache( "changePwdReplayCache" );
+        Cache< String, Object > cache = getDirectoryService().getCacheService().
+            getCache( "changePwdReplayCache", String.class, Object.class );
         replayCache = new ReplayCacheImpl( cache );
 
         for ( Transport transport : transports )
diff --git a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
index b20dcfc..e23488f 100644
--- a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
+++ b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
@@ -22,8 +22,6 @@ package org.apache.directory.server.kerberos.kdc;
 
 import java.io.IOException;
 
-import net.sf.ehcache.Cache;
-
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.server.kerberos.KerberosConfig;
@@ -41,6 +39,7 @@ import org.apache.mina.core.filterchain.IoFilterChainBuilder;
 import org.apache.mina.core.service.IoAcceptor;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.ehcache.Cache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -111,7 +110,8 @@ public class KdcServer extends DirectoryBackedService
 
         LOG.debug( "initializing the kerberos replay cache" );
 
-        Cache cache = getDirectoryService().getCacheService().getCache( "kdcReplayCache" );
+        Cache< String, Object > cache = getDirectoryService().getCacheService().
+            getCache( "kdcReplayCache", String.class, Object.class );
         replayCache = new ReplayCacheImpl( cache, config.getAllowableClockSkew() );
 
         // Kerberos can use UDP or TCP
diff --git a/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java b/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
index 62bde05..411ed12 100644
--- a/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
+++ b/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
@@ -103,7 +103,8 @@ public class ChangePasswordConfigReaderTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java b/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
index 45163ae..d076429 100644
--- a/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
+++ b/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
@@ -101,7 +101,8 @@ public class ConfigPartitionReaderTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java b/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
index b4462fe..76ac4aa 100644
--- a/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
+++ b/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
@@ -107,7 +107,8 @@ public class ConfigWriterTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java b/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
index 8227222..d8e42cd 100644
--- a/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
+++ b/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
@@ -100,7 +100,8 @@ public class HttpServerConfigReaderTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java b/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
index ab9e2a8..5126011 100644
--- a/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
+++ b/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
@@ -101,7 +101,8 @@ public class KerberosServerConfigReaderTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java b/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
index b71c58b..1c34942 100644
--- a/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
+++ b/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
@@ -101,7 +101,8 @@ public class LdapServerConfigReaderTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/server-integ/src/test/resources/log4j.properties b/server-integ/src/test/resources/log4j.properties
index 7586e5c..6a46f09 100644
--- a/server-integ/src/test/resources/log4j.properties
+++ b/server-integ/src/test/resources/log4j.properties
@@ -39,7 +39,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
 log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
 log4j.logger.org.apache.directory.api=FATAL
 log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
 log4j.logger.org.apache.mina=FATAL
 log4j.logger.org.apache.directory.mavibot=FATAL
 log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
diff --git a/service-builder/src/test/resources/log4j.properties b/service-builder/src/test/resources/log4j.properties
index 7586e5c..6a46f09 100755
--- a/service-builder/src/test/resources/log4j.properties
+++ b/service-builder/src/test/resources/log4j.properties
@@ -39,7 +39,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
 log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
 log4j.logger.org.apache.directory.api=FATAL
 log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
 log4j.logger.org.apache.mina=FATAL
 log4j.logger.org.apache.directory.mavibot=FATAL
 log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
diff --git a/service/log4j.properties b/service/log4j.properties
index 18eb079..92626e3 100644
--- a/service/log4j.properties
+++ b/service/log4j.properties
@@ -35,7 +35,7 @@ log4j.appender.stdout.layout.ConversionPattern=[%d{yyyy-mm-dd'T'HH:mm:ss.sssZ}]
 log4j.logger.org.apache.directory.server=WARN
 
 # external lib, you may never need to change this logger's level
-log4j.logger.net.sf.ehcache=WARN
+log4j.logger.org.ehcache=WARN
 log4j.logger.org.apache.mina=WARN
 
 # with these we'll not get innundated when switching to DEBUG
diff --git a/service/src/main/java/org/apache/directory/server/ApacheDsService.java b/service/src/main/java/org/apache/directory/server/ApacheDsService.java
index 0e60530..2ae1b46 100644
--- a/service/src/main/java/org/apache/directory/server/ApacheDsService.java
+++ b/service/src/main/java/org/apache/directory/server/ApacheDsService.java
@@ -178,7 +178,8 @@ public class ApacheDsService
         cacheService.initialize( instanceLayout );
 
         initSchemaManager( instanceLayout );
-        DnFactory dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        DnFactory dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
         initSchemaLdifPartition( instanceLayout, dnFactory );
         initConfigPartition( instanceLayout, dnFactory, cacheService );
 
diff --git a/xdbm-partition/pom.xml b/xdbm-partition/pom.xml
index 9909a48..84c156a 100644
--- a/xdbm-partition/pom.xml
+++ b/xdbm-partition/pom.xml
@@ -121,9 +121,8 @@
             </Export-Package>
             <Import-Package>
                 javax.naming,
-                net.sf.ehcache;version=${ehcache.version},
-                net.sf.ehcache.config;version=${ehcache.version},
-                net.sf.ehcache.store;version=${ehcache.version},
+                org.ehcache;version=${ehcache.version},
+                org.ehcache.config;version=${ehcache.version},
                 org.apache.directory.api.i18n;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
                 org.apache.directory.api.ldap.model.cursor;version=${org.apache.directory.api.version},
diff --git a/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java b/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
index 3adf4ca..60b7b6e 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
@@ -35,10 +35,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.store.LruPolicy;
+import org.ehcache.Cache;
+import org.ehcache.config.CacheConfiguration;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.Cursor;
@@ -131,10 +129,10 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
     protected int cacheSize = DEFAULT_CACHE_SIZE;
 
     /** The alias cache */
-    protected Cache aliasCache;
+    protected Cache< String, Dn > aliasCache;
 
     /** The ParentIdAndRdn cache */
-    protected Cache piarCache;
+    protected Cache< String, ParentIdAndRdn > piarCache;
 
     /** true if we sync disks on every write operation */
     protected AtomicBoolean isSyncOnWrite = new AtomicBoolean( true );
@@ -206,7 +204,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
     private ReadWriteLock rwLock;
 
     /** a cache to hold <entryUUID, Dn> pairs, this is used for speeding up the buildEntryDn() method */
-    private Cache entryDnCache;
+    private Cache<String, Dn> entryDnCache;
     
     /** a semaphore to serialize the writes on context entry while updating contextCSN attribute */
     private Semaphore ctxCsnSemaphore = new Semaphore( 1 );
@@ -541,7 +539,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
         // don't reset initialized flag
         initialized = false;
 
-        entryDnCache.removeAll();
+        entryDnCache.clear();
         
         MultiException errors = new MultiException( I18n.err( I18n.ERR_577 ) );
 
@@ -627,29 +625,13 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
 
         if ( cacheService != null )
         {
-            aliasCache = cacheService.getCache( "alias" );
+            aliasCache = cacheService.getCache( "alias", String.class, Dn.class );
     
-            CacheConfiguration cacheConfiguration = aliasCache.getCacheConfiguration();
+            CacheConfiguration< String, Dn > aliasCacheConfig = aliasCache.getRuntimeConfiguration();
             
-            int cacheSizeConfig = ( int ) cacheConfiguration.getMaxEntriesLocalHeap();
-    
-            if ( cacheSizeConfig < cacheSize )
-            {
-                aliasCache.getCacheConfiguration().setMaxEntriesLocalHeap( cacheSize );
-            }
-            
-            piarCache = cacheService.getCache( "piar" );
-            
-            cacheSizeConfig = ( int ) piarCache.getCacheConfiguration().getMaxEntriesLocalHeap();
-    
-            if ( cacheSizeConfig < cacheSize )
-            {
-                piarCache.getCacheConfiguration().setMaxEntriesLocalHeap( cacheSize * 3L );
-            }
+            piarCache = cacheService.getCache( "piar", String.class, ParentIdAndRdn.class );
             
-            entryDnCache = cacheService.getCache( "entryDn" );
-            entryDnCache.setMemoryStoreEvictionPolicy( new LruPolicy() );
-            entryDnCache.getCacheConfiguration().setMaxEntriesLocalHeap( cacheSize );
+            entryDnCache = cacheService.getCache( "entryDn", String.class, Dn.class );
         }
     }
 
@@ -1303,6 +1285,11 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
         {
             rwLock.readLock().lock();
 
+            if ( id == null )
+            {
+                id = "";
+            }
+            
             Dn dn = buildEntryDn( partitionTxn, id );
 
             return fetch( partitionTxn, id, dn );
@@ -2022,7 +2009,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
         // Remove the EntryDN
         modifiedEntry.removeAttributes( entryDnAT );
 
-        entryDnCache.removeAll();
+        entryDnCache.clear();
         
         setContextCsn( modifiedEntry.get( entryCsnAT ).getString() );
 
@@ -2200,7 +2187,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
         modifiedEntry.add( ApacheSchemaConstants.ENTRY_PARENT_ID_OID, newParentId );
         
         // Doom the DN cache now
-        entryDnCache.removeAll();
+        entryDnCache.clear();
 
         setContextCsn( modifiedEntry.get( entryCsnAT ).getString() );
 
@@ -2350,7 +2337,6 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
         {
             String newNormType = newAtav.getNormType();
             Object newNormValue = newAtav.getValue().getValue();
-            boolean oldRemoved = false;
 
             AttributeType newRdnAttrType = schemaManager.lookupAttributeTypeRegistry( newNormType );
 
@@ -2533,7 +2519,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
 
         rdnIdx.add( partitionTxn, parentIdAndRdn, oldId );
 
-        entryDnCache.removeAll();
+        entryDnCache.clear();
         
         if ( isSyncOnWrite.get() )
         {
@@ -2631,11 +2617,11 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
 
             if ( entryDnCache != null )
             {
-                Element el = entryDnCache.get( id );
+                Dn cachedDn = entryDnCache.get( id );
                 
-                if ( el != null )
+                if ( cachedDn != null )
                 {
-                    return ( Dn ) el.getObjectValue();
+                    return cachedDn;
                 }
             }
             
@@ -2645,13 +2631,9 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
             
                 if ( piarCache != null )
                 {
-                    Element piar = piarCache.get( parentId );
+                    cur = piarCache.get( parentId );
                     
-                    if ( piar != null )
-                    {
-                        cur = ( ParentIdAndRdn ) piar.getObjectValue();
-                    }
-                    else
+                    if ( cur == null )
                     {
                         cur = rdnIdx.reverseLookup( partitionTxn, parentId );
                         
@@ -2660,7 +2642,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
                             return null;
                         }
                         
-                        piarCache.put( new Element( parentId, cur ) );
+                        piarCache.put( parentId, cur );
                     }
                 }
                 else
@@ -2694,7 +2676,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
             
             dn = new Dn( schemaManager, Arrays.copyOf( rdnArray, pos ) );
             
-            entryDnCache.put( new Element( id, dn ) );
+            entryDnCache.put( id, dn );
             return dn;
         }
         finally
@@ -3198,7 +3180,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
         
         if ( aliasCache != null )
         {
-            aliasCache.put( new Element( aliasId, aliasTarget ) );
+            aliasCache.put( aliasId, aliasTarget );
         }
 
         /*
@@ -3589,7 +3571,7 @@ public abstract class AbstractBTreePartition extends AbstractPartition implement
      * {@inheritDoc}
      */
     @Override
-    public Cache getAliasCache()
+    public Cache<String, Dn> getAliasCache()
     {
         return aliasCache;
     }
diff --git a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
index f11c217..595f4ab 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
@@ -30,7 +30,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.locks.ReadWriteLock;
 
-import net.sf.ehcache.Cache;
+import org.ehcache.Cache;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Entry;
@@ -485,5 +485,5 @@ public interface Store
      * @return the Alias cache
      * @return The cache
      */
-    Cache getAliasCache();
+    Cache< String, Dn > getAliasCache();
 }
diff --git a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
index 2207570..67f3bdf 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
@@ -20,8 +20,6 @@
 package org.apache.directory.server.xdbm.search.evaluator;
 
 
-import net.sf.ehcache.Element;
-
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.filter.ScopeNode;
@@ -177,12 +175,10 @@ public class SubtreeScopeEvaluator implements Evaluator<ScopeNode>
          */
         if ( db.getAliasCache() != null )
         {
-            Element element = db.getAliasCache().get( id );
+            Dn dn = db.getAliasCache().get( id );
             
-            if ( ( element != null ) && ( element.getObjectValue() != null ) )
+            if ( dn != null )
             {
-                Dn dn = ( Dn ) element.getObjectValue();
-
                 return false;
             }
         }
diff --git a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
index acf0806..0918241 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
@@ -23,8 +23,6 @@ package org.apache.directory.server.xdbm.search.impl;
 import java.util.HashSet;
 import java.util.Set;
 
-import net.sf.ehcache.Element;
-
 import org.apache.directory.api.ldap.model.cursor.Cursor;
 import org.apache.directory.api.ldap.model.cursor.CursorException;
 import org.apache.directory.api.ldap.model.entry.Entry;
@@ -157,12 +155,7 @@ public class DefaultSearchEngine implements SearchEngine
 
         if ( db.getAliasCache() != null )
         {
-            Element aliasBaseElement = db.getAliasCache().get( baseId );
-
-            if ( aliasBaseElement != null )
-            {
-                aliasedBase = ( Dn ) ( aliasBaseElement ).getObjectValue();
-            }
+            aliasedBase = db.getAliasCache().get( baseId );
         }
         else
         {
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
index 0125c46..11d8617 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
@@ -35,8 +35,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import net.sf.ehcache.store.AbstractStore;
-
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.csn.CsnFactory;
 import org.apache.directory.api.ldap.model.entry.Attribute;
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
index 51feb72..6d15b54 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
@@ -62,12 +62,10 @@ import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.entry.ClonedServerEntry;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ModDnAva;
-import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.PartitionTxn;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.apache.directory.server.xdbm.IndexNotFoundException;
-import org.apache.directory.server.xdbm.MockPartitionReadTxn;
 import org.apache.directory.server.xdbm.StoreUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -127,7 +125,8 @@ public class AvlPartitionTest
         schemaManager = new DefaultSchemaManager( loader );
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
 
         boolean loaded = schemaManager.loadAllEnabled();
 
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
index 7e284a1..b737b5a 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
@@ -118,7 +118,8 @@ public class EqualityTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
index fdf01f9..da63f15 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
@@ -129,7 +129,8 @@ public class GreaterEqNotIndexedTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
     }
 
 
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
index c1ac6e3..7cd2317 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
@@ -128,7 +128,9 @@ public class GreaterEqTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
+
     }
 
 
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
index 1b91615..a5442c1 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
@@ -129,7 +129,9 @@ public class LessEqTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
+
     }
 
 
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
index 74c45e4..4cc8132 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
@@ -115,7 +115,9 @@ public class PresenceTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
+
         
         NORMALIZED_CN_OID = schemaManager.getAttributeType( ApacheSchemaConstants.APACHE_PRESENCE_AT ).getEquality().getNormalizer().normalize( SchemaConstants.CN_AT_OID );
     }
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
index 4a75633..d9ad172 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
@@ -109,7 +109,9 @@ public class SubstringTest
 
         cacheService = new CacheService();
         cacheService.initialize( null );
-        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+        dnFactory = new DefaultDnFactory( schemaManager, 
+            cacheService.getCache( "dnCache", String.class, Dn.class ) );
+
     }
 
 


[directory-server] 02/02: Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit 4ce5d954332e790db494f584925bc3a0a9e65375
Merge: 5d40c41 d560fc9
Author: Emmanuel Lecharny <el...@apache.org>
AuthorDate: Fri Jan 4 08:04:57 2019 +0100

    Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server

 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --cc pom.xml
index 93e9f4b,38dce3b..6d6407a
--- a/pom.xml
+++ b/pom.xml
@@@ -64,11 -64,11 +64,11 @@@
      <commons.net.version>3.6</commons.net.version>
      <commons.pool.version>2.6.0</commons.pool.version>
      <dnsjava.version>2.1.8</dnsjava.version>
 -    <ehcache.version>2.10.4</ehcache.version>
 +    <ehcache.version>3.6.1</ehcache.version>
      <findbugs.annotations.version>1.0.0</findbugs.annotations.version>
-     <jetty.version>9.4.5.v20170502</jetty.version>
+     <jetty.version>9.4.14.v20181114</jetty.version>
      <!-- The Jetty bundle exports are using version 9.4.5, not 9.4.5.v20170502... -->
-     <jetty.bundle.version>9.4.5</jetty.bundle.version>
+     <jetty.bundle.version>9.4.14</jetty.bundle.version>
      <junit.version>4.12</junit.version>
      <ldapsdk.version>4.1</ldapsdk.version>
      <log4j.version>1.2.17</log4j.version>