You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jason Pell <ja...@pellcorp.com> on 2014/05/26 04:52:26 UTC

Sharing a eh cache manager

Hi,

I already create a eh cache manager for caching spring security ldap user
details.  I would like to force CXF to use the very same eh cache manager
rather than create a new one.

I have the following spring bean:

org.springframework.cache.ehcache.EhCacheManagerFactoryBean

<bean id="ehCacheManager"
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation"
value="file:${spring.config.dir}/ehcache.xml" />
        <property name="shared" value="true" />
    </bean>

So I would like to put all of the configuration for ehcache into the
ehcache.xml I use for hibernate and spring security.

Any suggestions as to how I might do this?

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
So I managed to work around the file not found thing by turning off
overflow to disk for the caches, by adding:

<cache name="ws-security.nonce.cache.instance"
        overflowToDisk="false"
         maxEntriesLocalHeap="10000"
         timeToIdleSeconds="3600"
         timeToLiveSeconds="3600" />

    <cache name="ws-security.timestamp.cache.instance"
        overflowToDisk="false"
         maxEntriesLocalHeap="10000"
         timeToIdleSeconds="3600"
         timeToLiveSeconds="3600" />


But I had to configure a different location for the ehcache config to do
something like this:

properties.put(SecurityConstants.CACHE_CONFIG_FILE, new
URL("file:${spring.config.dir}/ehcache.xml"));

Not sure what consequences disabling file overflow will have.



On Mon, May 26, 2014 at 1:10 PM, Jason Pell <ja...@pellcorp.com> wrote:

> I realised sharing is not going to work, unless the shutdown sequence for
> a manager is also disabled where it's a single global instance.  I remember
> finding a problem with cxf and ehcache when it inadvertently used a shared
> instance.  It actually shut down the single global instance when a service
> was shut down.
>
> Colm - any reason why we can't share a single ehcache instance across the
> whole of cxf?  I am willing to get into the code and have a go at
> refactoring to support a single instance, but its not much point if there
> are reasons for creating separate instances I am not aware of.
>
> At the moment with the upgrade to 1.7.11 I am now getting:
>
> net.sf.ehcache.CacheException: java.io.FileNotFoundException:
> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
> (File name too long)
>         at
> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>         at net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>         at
> net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>         at
> net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>         at
> net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>         at
> net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>         at
> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>         at
> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>         at
> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>         at
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>         at
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>         at
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>         at
> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>         at
> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>
>
>
>
> On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com> wrote:
>
>> Hi,
>>
>> I already create a eh cache manager for caching spring security ldap user
>> details.  I would like to force CXF to use the very same eh cache manager
>> rather than create a new one.
>>
>> I have the following spring bean:
>>
>> org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>>
>> <bean id="ehCacheManager"
>>
>> class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>>         <property name="configLocation"
>> value="file:${spring.config.dir}/ehcache.xml" />
>>         <property name="shared" value="true" />
>>     </bean>
>>
>>  So I would like to put all of the configuration for ehcache into the
>> ehcache.xml I use for hibernate and spring security.
>>
>> Any suggestions as to how I might do this?
>>
>>
>>
>

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
Never mind - I managed to introduce the changes slightly differently into
3.0.x.  I did however submit a small patch to wss4j in aforementioned
wss-503 that calls cacheManager.removeCache(cache.getName()) which is
useful for cases where using a global cache manager.

But this code has also been added to the subclass close method with a
comment that it can be removed if added to wss4j


On Sun, Jun 15, 2014 at 2:06 PM, Jason Pell <ja...@pellcorp.com> wrote:

> https://issues.apache.org/jira/browse/WSS-503
>
>
>
> On Sun, Jun 15, 2014 at 1:58 PM, Jason Pell <ja...@pellcorp.com> wrote:
>
>> Colm,
>>
>> My solution does not work for CXF 3.0.x as the code I changed no longer
>> exists.  Its been moved into wss4j.  Any chance I can contribute a patch
>> for wss4j that would be released before CXF 3.0.1?
>>
>>
>> https://fisheye6.atlassian.com/changelog/cxf?cs=5c3be52b14609cae3548f5f0cb24dac391b7de86
>>
>>
>>
>>
>>
>>
>> On Fri, Jun 13, 2014 at 11:10 AM, Jason Pell <ja...@pellcorp.com> wrote:
>>
>>> I am going to work on allowing ehcache to use a Shared Cache manager.
>>> The separate cache instances should still remain, but we should not be
>>> forcing the creating of a new cache manager itself if possible.
>>>
>>> https://issues.apache.org/jira/browse/CXF-5802
>>>
>>>
>>>
>>> On Tue, May 27, 2014 at 7:49 AM, Jason Pell <ja...@pellcorp.com> wrote:
>>>
>>>> Sorry typo. I mean having a single global ehcache manager to manage all
>>>> cache instances.
>>>>  On 27/05/2014 7:41 AM, "Jason Pell" <ja...@pellcorp.com> wrote:
>>>>
>>>>> I meant more sharing a single manager instance on a cache instance.
>>>>> But it's not too urgent for me now that I have cxf using my ehcache config
>>>>> file.
>>>>> On 27/05/2014 2:15 AM, "Colm O hEigeartaigh" <co...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> I've merged a fix for the long filename issue:
>>>>>>
>>>>>> https://issues.apache.org/jira/browse/CXF-5766
>>>>>>
>>>>>> With regards to sharing a single EhCache instance, the problem is
>>>>>> that we
>>>>>> have different interfaces for token caching vs replay detection. For
>>>>>> token
>>>>>> caching, we don't persist tokens to disk, due to the fact that
>>>>>> SecurityTokens contain things that don't serialize (e.g. DOM
>>>>>> Elements).
>>>>>> There is no reason why you couldn't use a single cache for
>>>>>> UsernameToken
>>>>>> nonce + Signature/Timestamp caching though (ReplayCache) if you
>>>>>> wanted.
>>>>>>
>>>>>> Colm.
>>>>>>
>>>>>>
>>>>>> On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com>
>>>>>> wrote:
>>>>>>
>>>>>> > I realised sharing is not going to work, unless the shutdown
>>>>>> sequence for a
>>>>>> > manager is also disabled where it's a single global instance.  I
>>>>>> remember
>>>>>> > finding a problem with cxf and ehcache when it inadvertently used a
>>>>>> shared
>>>>>> > instance.  It actually shut down the single global instance when a
>>>>>> service
>>>>>> > was shut down.
>>>>>> >
>>>>>> > Colm - any reason why we can't share a single ehcache instance
>>>>>> across the
>>>>>> > whole of cxf?  I am willing to get into the code and have a go at
>>>>>> > refactoring to support a single instance, but its not much point if
>>>>>> there
>>>>>> > are reasons for creating separate instances I am not aware of.
>>>>>> >
>>>>>> > At the moment with the upgrade to 1.7.11 I am now getting:
>>>>>> >
>>>>>> > net.sf.ehcache.CacheException: java.io.FileNotFoundException:
>>>>>> >
>>>>>> >
>>>>>> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
>>>>>> > (File name too long)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>>>>>> >         at
>>>>>> net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>>>>>> >         at
>>>>>> >
>>>>>> net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>>>>>> >         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>>>>>> >         at
>>>>>> >
>>>>>> net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>>>>>> >         at
>>>>>> > net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>>>>>> >         at
>>>>>> > net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>>>>>> >         at
>>>>>> >
>>>>>> >
>>>>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com>
>>>>>> wrote:
>>>>>> >
>>>>>> > > Hi,
>>>>>> > >
>>>>>> > > I already create a eh cache manager for caching spring security
>>>>>> ldap user
>>>>>> > > details.  I would like to force CXF to use the very same eh cache
>>>>>> manager
>>>>>> > > rather than create a new one.
>>>>>> > >
>>>>>> > > I have the following spring bean:
>>>>>> > >
>>>>>> > > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>>>>>> > >
>>>>>> > > <bean id="ehCacheManager"
>>>>>> > >
>>>>>> > >
>>>>>> class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>>>>>> > >         <property name="configLocation"
>>>>>> > > value="file:${spring.config.dir}/ehcache.xml" />
>>>>>> > >         <property name="shared" value="true" />
>>>>>> > >     </bean>
>>>>>> > >
>>>>>> > > So I would like to put all of the configuration for ehcache into
>>>>>> the
>>>>>> > > ehcache.xml I use for hibernate and spring security.
>>>>>> > >
>>>>>> > > Any suggestions as to how I might do this?
>>>>>> > >
>>>>>> > >
>>>>>> > >
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Colm O hEigeartaigh
>>>>>>
>>>>>> Talend Community Coder
>>>>>> http://coders.talend.com
>>>>>>
>>>>>
>>>
>>
>

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
https://issues.apache.org/jira/browse/WSS-503



On Sun, Jun 15, 2014 at 1:58 PM, Jason Pell <ja...@pellcorp.com> wrote:

> Colm,
>
> My solution does not work for CXF 3.0.x as the code I changed no longer
> exists.  Its been moved into wss4j.  Any chance I can contribute a patch
> for wss4j that would be released before CXF 3.0.1?
>
>
> https://fisheye6.atlassian.com/changelog/cxf?cs=5c3be52b14609cae3548f5f0cb24dac391b7de86
>
>
>
>
>
>
> On Fri, Jun 13, 2014 at 11:10 AM, Jason Pell <ja...@pellcorp.com> wrote:
>
>> I am going to work on allowing ehcache to use a Shared Cache manager.
>> The separate cache instances should still remain, but we should not be
>> forcing the creating of a new cache manager itself if possible.
>>
>> https://issues.apache.org/jira/browse/CXF-5802
>>
>>
>>
>> On Tue, May 27, 2014 at 7:49 AM, Jason Pell <ja...@pellcorp.com> wrote:
>>
>>> Sorry typo. I mean having a single global ehcache manager to manage all
>>> cache instances.
>>>  On 27/05/2014 7:41 AM, "Jason Pell" <ja...@pellcorp.com> wrote:
>>>
>>>> I meant more sharing a single manager instance on a cache instance. But
>>>> it's not too urgent for me now that I have cxf using my ehcache config
>>>> file.
>>>> On 27/05/2014 2:15 AM, "Colm O hEigeartaigh" <co...@apache.org>
>>>> wrote:
>>>>
>>>>> I've merged a fix for the long filename issue:
>>>>>
>>>>> https://issues.apache.org/jira/browse/CXF-5766
>>>>>
>>>>> With regards to sharing a single EhCache instance, the problem is that
>>>>> we
>>>>> have different interfaces for token caching vs replay detection. For
>>>>> token
>>>>> caching, we don't persist tokens to disk, due to the fact that
>>>>> SecurityTokens contain things that don't serialize (e.g. DOM Elements).
>>>>> There is no reason why you couldn't use a single cache for
>>>>> UsernameToken
>>>>> nonce + Signature/Timestamp caching though (ReplayCache) if you wanted.
>>>>>
>>>>> Colm.
>>>>>
>>>>>
>>>>> On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com>
>>>>> wrote:
>>>>>
>>>>> > I realised sharing is not going to work, unless the shutdown
>>>>> sequence for a
>>>>> > manager is also disabled where it's a single global instance.  I
>>>>> remember
>>>>> > finding a problem with cxf and ehcache when it inadvertently used a
>>>>> shared
>>>>> > instance.  It actually shut down the single global instance when a
>>>>> service
>>>>> > was shut down.
>>>>> >
>>>>> > Colm - any reason why we can't share a single ehcache instance
>>>>> across the
>>>>> > whole of cxf?  I am willing to get into the code and have a go at
>>>>> > refactoring to support a single instance, but its not much point if
>>>>> there
>>>>> > are reasons for creating separate instances I am not aware of.
>>>>> >
>>>>> > At the moment with the upgrade to 1.7.11 I am now getting:
>>>>> >
>>>>> > net.sf.ehcache.CacheException: java.io.FileNotFoundException:
>>>>> >
>>>>> >
>>>>> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
>>>>> > (File name too long)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>>>>> >         at
>>>>> net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>>>>> >         at
>>>>> >
>>>>> net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>>>>> >         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>>>>> >         at
>>>>> > net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>>>>> >         at
>>>>> > net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>>>>> >         at
>>>>> > net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>>>>> >         at
>>>>> >
>>>>> >
>>>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com>
>>>>> wrote:
>>>>> >
>>>>> > > Hi,
>>>>> > >
>>>>> > > I already create a eh cache manager for caching spring security
>>>>> ldap user
>>>>> > > details.  I would like to force CXF to use the very same eh cache
>>>>> manager
>>>>> > > rather than create a new one.
>>>>> > >
>>>>> > > I have the following spring bean:
>>>>> > >
>>>>> > > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>>>>> > >
>>>>> > > <bean id="ehCacheManager"
>>>>> > >
>>>>> > >
>>>>> class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>>>>> > >         <property name="configLocation"
>>>>> > > value="file:${spring.config.dir}/ehcache.xml" />
>>>>> > >         <property name="shared" value="true" />
>>>>> > >     </bean>
>>>>> > >
>>>>> > > So I would like to put all of the configuration for ehcache into
>>>>> the
>>>>> > > ehcache.xml I use for hibernate and spring security.
>>>>> > >
>>>>> > > Any suggestions as to how I might do this?
>>>>> > >
>>>>> > >
>>>>> > >
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Colm O hEigeartaigh
>>>>>
>>>>> Talend Community Coder
>>>>> http://coders.talend.com
>>>>>
>>>>
>>
>

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
Colm,

My solution does not work for CXF 3.0.x as the code I changed no longer
exists.  Its been moved into wss4j.  Any chance I can contribute a patch
for wss4j that would be released before CXF 3.0.1?

https://fisheye6.atlassian.com/changelog/cxf?cs=5c3be52b14609cae3548f5f0cb24dac391b7de86






On Fri, Jun 13, 2014 at 11:10 AM, Jason Pell <ja...@pellcorp.com> wrote:

> I am going to work on allowing ehcache to use a Shared Cache manager.  The
> separate cache instances should still remain, but we should not be forcing
> the creating of a new cache manager itself if possible.
>
> https://issues.apache.org/jira/browse/CXF-5802
>
>
>
> On Tue, May 27, 2014 at 7:49 AM, Jason Pell <ja...@pellcorp.com> wrote:
>
>> Sorry typo. I mean having a single global ehcache manager to manage all
>> cache instances.
>>  On 27/05/2014 7:41 AM, "Jason Pell" <ja...@pellcorp.com> wrote:
>>
>>> I meant more sharing a single manager instance on a cache instance. But
>>> it's not too urgent for me now that I have cxf using my ehcache config
>>> file.
>>> On 27/05/2014 2:15 AM, "Colm O hEigeartaigh" <co...@apache.org>
>>> wrote:
>>>
>>>> I've merged a fix for the long filename issue:
>>>>
>>>> https://issues.apache.org/jira/browse/CXF-5766
>>>>
>>>> With regards to sharing a single EhCache instance, the problem is that
>>>> we
>>>> have different interfaces for token caching vs replay detection. For
>>>> token
>>>> caching, we don't persist tokens to disk, due to the fact that
>>>> SecurityTokens contain things that don't serialize (e.g. DOM Elements).
>>>> There is no reason why you couldn't use a single cache for UsernameToken
>>>> nonce + Signature/Timestamp caching though (ReplayCache) if you wanted.
>>>>
>>>> Colm.
>>>>
>>>>
>>>> On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com> wrote:
>>>>
>>>> > I realised sharing is not going to work, unless the shutdown sequence
>>>> for a
>>>> > manager is also disabled where it's a single global instance.  I
>>>> remember
>>>> > finding a problem with cxf and ehcache when it inadvertently used a
>>>> shared
>>>> > instance.  It actually shut down the single global instance when a
>>>> service
>>>> > was shut down.
>>>> >
>>>> > Colm - any reason why we can't share a single ehcache instance across
>>>> the
>>>> > whole of cxf?  I am willing to get into the code and have a go at
>>>> > refactoring to support a single instance, but its not much point if
>>>> there
>>>> > are reasons for creating separate instances I am not aware of.
>>>> >
>>>> > At the moment with the upgrade to 1.7.11 I am now getting:
>>>> >
>>>> > net.sf.ehcache.CacheException: java.io.FileNotFoundException:
>>>> >
>>>> >
>>>> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
>>>> > (File name too long)
>>>> >         at
>>>> >
>>>> >
>>>> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>>>> >         at
>>>> net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>>>> >         at
>>>> >
>>>> net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>>>> >         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>>>> >         at
>>>> > net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>>>> >         at
>>>> > net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>>>> >         at
>>>> > net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>>>> >         at
>>>> >
>>>> >
>>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com>
>>>> wrote:
>>>> >
>>>> > > Hi,
>>>> > >
>>>> > > I already create a eh cache manager for caching spring security
>>>> ldap user
>>>> > > details.  I would like to force CXF to use the very same eh cache
>>>> manager
>>>> > > rather than create a new one.
>>>> > >
>>>> > > I have the following spring bean:
>>>> > >
>>>> > > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>>>> > >
>>>> > > <bean id="ehCacheManager"
>>>> > >
>>>> > > class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>>>> > >         <property name="configLocation"
>>>> > > value="file:${spring.config.dir}/ehcache.xml" />
>>>> > >         <property name="shared" value="true" />
>>>> > >     </bean>
>>>> > >
>>>> > > So I would like to put all of the configuration for ehcache into the
>>>> > > ehcache.xml I use for hibernate and spring security.
>>>> > >
>>>> > > Any suggestions as to how I might do this?
>>>> > >
>>>> > >
>>>> > >
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Colm O hEigeartaigh
>>>>
>>>> Talend Community Coder
>>>> http://coders.talend.com
>>>>
>>>
>

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
I am going to work on allowing ehcache to use a Shared Cache manager.  The
separate cache instances should still remain, but we should not be forcing
the creating of a new cache manager itself if possible.

https://issues.apache.org/jira/browse/CXF-5802



On Tue, May 27, 2014 at 7:49 AM, Jason Pell <ja...@pellcorp.com> wrote:

> Sorry typo. I mean having a single global ehcache manager to manage all
> cache instances.
> On 27/05/2014 7:41 AM, "Jason Pell" <ja...@pellcorp.com> wrote:
>
>> I meant more sharing a single manager instance on a cache instance. But
>> it's not too urgent for me now that I have cxf using my ehcache config
>> file.
>> On 27/05/2014 2:15 AM, "Colm O hEigeartaigh" <co...@apache.org> wrote:
>>
>>> I've merged a fix for the long filename issue:
>>>
>>> https://issues.apache.org/jira/browse/CXF-5766
>>>
>>> With regards to sharing a single EhCache instance, the problem is that we
>>> have different interfaces for token caching vs replay detection. For
>>> token
>>> caching, we don't persist tokens to disk, due to the fact that
>>> SecurityTokens contain things that don't serialize (e.g. DOM Elements).
>>> There is no reason why you couldn't use a single cache for UsernameToken
>>> nonce + Signature/Timestamp caching though (ReplayCache) if you wanted.
>>>
>>> Colm.
>>>
>>>
>>> On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com> wrote:
>>>
>>> > I realised sharing is not going to work, unless the shutdown sequence
>>> for a
>>> > manager is also disabled where it's a single global instance.  I
>>> remember
>>> > finding a problem with cxf and ehcache when it inadvertently used a
>>> shared
>>> > instance.  It actually shut down the single global instance when a
>>> service
>>> > was shut down.
>>> >
>>> > Colm - any reason why we can't share a single ehcache instance across
>>> the
>>> > whole of cxf?  I am willing to get into the code and have a go at
>>> > refactoring to support a single instance, but its not much point if
>>> there
>>> > are reasons for creating separate instances I am not aware of.
>>> >
>>> > At the moment with the upgrade to 1.7.11 I am now getting:
>>> >
>>> > net.sf.ehcache.CacheException: java.io.FileNotFoundException:
>>> >
>>> >
>>> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
>>> > (File name too long)
>>> >         at
>>> >
>>> >
>>> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>>> >         at
>>> net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>>> >         at
>>> >
>>> net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>>> >         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>>> >         at
>>> > net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>>> >         at
>>> > net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>>> >         at
>>> > net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>>> >         at
>>> >
>>> >
>>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>>> >
>>> >
>>> >
>>> >
>>> > On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com>
>>> wrote:
>>> >
>>> > > Hi,
>>> > >
>>> > > I already create a eh cache manager for caching spring security ldap
>>> user
>>> > > details.  I would like to force CXF to use the very same eh cache
>>> manager
>>> > > rather than create a new one.
>>> > >
>>> > > I have the following spring bean:
>>> > >
>>> > > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>>> > >
>>> > > <bean id="ehCacheManager"
>>> > >
>>> > > class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>>> > >         <property name="configLocation"
>>> > > value="file:${spring.config.dir}/ehcache.xml" />
>>> > >         <property name="shared" value="true" />
>>> > >     </bean>
>>> > >
>>> > > So I would like to put all of the configuration for ehcache into the
>>> > > ehcache.xml I use for hibernate and spring security.
>>> > >
>>> > > Any suggestions as to how I might do this?
>>> > >
>>> > >
>>> > >
>>> >
>>>
>>>
>>>
>>> --
>>> Colm O hEigeartaigh
>>>
>>> Talend Community Coder
>>> http://coders.talend.com
>>>
>>

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
Sorry typo. I mean having a single global ehcache manager to manage all
cache instances.
On 27/05/2014 7:41 AM, "Jason Pell" <ja...@pellcorp.com> wrote:

> I meant more sharing a single manager instance on a cache instance. But
> it's not too urgent for me now that I have cxf using my ehcache config
> file.
> On 27/05/2014 2:15 AM, "Colm O hEigeartaigh" <co...@apache.org> wrote:
>
>> I've merged a fix for the long filename issue:
>>
>> https://issues.apache.org/jira/browse/CXF-5766
>>
>> With regards to sharing a single EhCache instance, the problem is that we
>> have different interfaces for token caching vs replay detection. For token
>> caching, we don't persist tokens to disk, due to the fact that
>> SecurityTokens contain things that don't serialize (e.g. DOM Elements).
>> There is no reason why you couldn't use a single cache for UsernameToken
>> nonce + Signature/Timestamp caching though (ReplayCache) if you wanted.
>>
>> Colm.
>>
>>
>> On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com> wrote:
>>
>> > I realised sharing is not going to work, unless the shutdown sequence
>> for a
>> > manager is also disabled where it's a single global instance.  I
>> remember
>> > finding a problem with cxf and ehcache when it inadvertently used a
>> shared
>> > instance.  It actually shut down the single global instance when a
>> service
>> > was shut down.
>> >
>> > Colm - any reason why we can't share a single ehcache instance across
>> the
>> > whole of cxf?  I am willing to get into the code and have a go at
>> > refactoring to support a single instance, but its not much point if
>> there
>> > are reasons for creating separate instances I am not aware of.
>> >
>> > At the moment with the upgrade to 1.7.11 I am now getting:
>> >
>> > net.sf.ehcache.CacheException: java.io.FileNotFoundException:
>> >
>> >
>> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
>> > (File name too long)
>> >         at
>> >
>> >
>> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>> >         at
>> net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>> >         at
>> > net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>> >         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>> >         at
>> > net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>> >         at
>> > net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>> >         at
>> > net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>> >         at
>> >
>> >
>> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>> >
>> >
>> >
>> >
>> > On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com>
>> wrote:
>> >
>> > > Hi,
>> > >
>> > > I already create a eh cache manager for caching spring security ldap
>> user
>> > > details.  I would like to force CXF to use the very same eh cache
>> manager
>> > > rather than create a new one.
>> > >
>> > > I have the following spring bean:
>> > >
>> > > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>> > >
>> > > <bean id="ehCacheManager"
>> > >
>> > > class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>> > >         <property name="configLocation"
>> > > value="file:${spring.config.dir}/ehcache.xml" />
>> > >         <property name="shared" value="true" />
>> > >     </bean>
>> > >
>> > > So I would like to put all of the configuration for ehcache into the
>> > > ehcache.xml I use for hibernate and spring security.
>> > >
>> > > Any suggestions as to how I might do this?
>> > >
>> > >
>> > >
>> >
>>
>>
>>
>> --
>> Colm O hEigeartaigh
>>
>> Talend Community Coder
>> http://coders.talend.com
>>
>

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
I meant more sharing a single manager instance on a cache instance. But
it's not too urgent for me now that I have cxf using my ehcache config
file.
On 27/05/2014 2:15 AM, "Colm O hEigeartaigh" <co...@apache.org> wrote:

> I've merged a fix for the long filename issue:
>
> https://issues.apache.org/jira/browse/CXF-5766
>
> With regards to sharing a single EhCache instance, the problem is that we
> have different interfaces for token caching vs replay detection. For token
> caching, we don't persist tokens to disk, due to the fact that
> SecurityTokens contain things that don't serialize (e.g. DOM Elements).
> There is no reason why you couldn't use a single cache for UsernameToken
> nonce + Signature/Timestamp caching though (ReplayCache) if you wanted.
>
> Colm.
>
>
> On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com> wrote:
>
> > I realised sharing is not going to work, unless the shutdown sequence
> for a
> > manager is also disabled where it's a single global instance.  I remember
> > finding a problem with cxf and ehcache when it inadvertently used a
> shared
> > instance.  It actually shut down the single global instance when a
> service
> > was shut down.
> >
> > Colm - any reason why we can't share a single ehcache instance across the
> > whole of cxf?  I am willing to get into the code and have a go at
> > refactoring to support a single instance, but its not much point if there
> > are reasons for creating separate instances I am not aware of.
> >
> > At the moment with the upgrade to 1.7.11 I am now getting:
> >
> > net.sf.ehcache.CacheException: java.io.FileNotFoundException:
> >
> >
> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
> > (File name too long)
> >         at
> >
> >
> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
> >         at net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
> >         at
> > net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
> >         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
> >         at
> > net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
> >         at
> > net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
> >         at
> > net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
> >         at
> >
> >
> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
> >         at
> >
> >
> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
> >         at
> >
> >
> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
> >         at
> >
> >
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
> >         at
> >
> >
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
> >         at
> >
> >
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
> >         at
> >
> >
> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
> >         at
> >
> >
> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
> >
> >
> >
> >
> > On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com> wrote:
> >
> > > Hi,
> > >
> > > I already create a eh cache manager for caching spring security ldap
> user
> > > details.  I would like to force CXF to use the very same eh cache
> manager
> > > rather than create a new one.
> > >
> > > I have the following spring bean:
> > >
> > > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
> > >
> > > <bean id="ehCacheManager"
> > >
> > > class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
> > >         <property name="configLocation"
> > > value="file:${spring.config.dir}/ehcache.xml" />
> > >         <property name="shared" value="true" />
> > >     </bean>
> > >
> > > So I would like to put all of the configuration for ehcache into the
> > > ehcache.xml I use for hibernate and spring security.
> > >
> > > Any suggestions as to how I might do this?
> > >
> > >
> > >
> >
>
>
>
> --
> Colm O hEigeartaigh
>
> Talend Community Coder
> http://coders.talend.com
>

Re: Sharing a eh cache manager

Posted by Colm O hEigeartaigh <co...@apache.org>.
I've merged a fix for the long filename issue:

https://issues.apache.org/jira/browse/CXF-5766

With regards to sharing a single EhCache instance, the problem is that we
have different interfaces for token caching vs replay detection. For token
caching, we don't persist tokens to disk, due to the fact that
SecurityTokens contain things that don't serialize (e.g. DOM Elements).
There is no reason why you couldn't use a single cache for UsernameToken
nonce + Signature/Timestamp caching though (ReplayCache) if you wanted.

Colm.


On Mon, May 26, 2014 at 4:10 AM, Jason Pell <ja...@pellcorp.com> wrote:

> I realised sharing is not going to work, unless the shutdown sequence for a
> manager is also disabled where it's a single global instance.  I remember
> finding a problem with cxf and ehcache when it inadvertently used a shared
> instance.  It actually shut down the single global instance when a service
> was shut down.
>
> Colm - any reason why we can't share a single ehcache instance across the
> whole of cxf?  I am willing to get into the code and have a go at
> refactoring to support a single instance, but its not much point if there
> are reasons for creating separate instances I am not aware of.
>
> At the moment with the upgrade to 1.7.11 I am now getting:
>
> net.sf.ehcache.CacheException: java.io.FileNotFoundException:
>
> ../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
> (File name too long)
>         at
>
> net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
>         at net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
>         at
> net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
>         at net.sf.ehcache.Cache.initialise(Cache.java:1154)
>         at
> net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
>         at
> net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
>         at
> net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
>         at
>
> org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
>         at
>
> org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
>         at
>
> org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
>         at
>
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
>         at
>
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
>         at
>
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
>         at
>
> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
>         at
>
> org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)
>
>
>
>
> On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com> wrote:
>
> > Hi,
> >
> > I already create a eh cache manager for caching spring security ldap user
> > details.  I would like to force CXF to use the very same eh cache manager
> > rather than create a new one.
> >
> > I have the following spring bean:
> >
> > org.springframework.cache.ehcache.EhCacheManagerFactoryBean
> >
> > <bean id="ehCacheManager"
> >
> > class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
> >         <property name="configLocation"
> > value="file:${spring.config.dir}/ehcache.xml" />
> >         <property name="shared" value="true" />
> >     </bean>
> >
> > So I would like to put all of the configuration for ehcache into the
> > ehcache.xml I use for hibernate and spring security.
> >
> > Any suggestions as to how I might do this?
> >
> >
> >
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: Sharing a eh cache manager

Posted by Jason Pell <ja...@pellcorp.com>.
I realised sharing is not going to work, unless the shutdown sequence for a
manager is also disabled where it's a single global instance.  I remember
finding a problem with cxf and ehcache when it inadvertently used a shared
instance.  It actually shut down the single global instance when a service
was shut down.

Colm - any reason why we can't share a single ehcache instance across the
whole of cxf?  I am willing to get into the code and have a go at
refactoring to support a single instance, but its not much point if there
are reasons for creating separate instances I am not aware of.

At the moment with the upgrade to 1.7.11 I am now getting:

net.sf.ehcache.CacheException: java.io.FileNotFoundException:
../tmp/cxf1876821037/ws-security%002enonce%002ecache%002einstance-{http%003a%002f%002fcom%002evedaadvantage%002fdp3%002f%0045nterprise%002f%0053ystem2%002f%0042usiness3%002f%0047raceful%0044eployment%0042usiness%0053ervice}%0047raceful%0044eployment%0042usiness%0053ervice.data
(File name too long)
        at
net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:142)
        at net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:155)
        at
net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:183)
        at net.sf.ehcache.Cache.initialise(Cache.java:1154)
        at
net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1336)
        at
net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1396)
        at
net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1908)
        at
org.apache.cxf.ws.security.cache.EHCacheReplayCache.<init>(EHCacheReplayCache.java:59)
        at
org.apache.cxf.ws.security.cache.EHCacheReplayCacheFactory.newReplayCache(EHCacheReplayCacheFactory.java:34)
        at
org.apache.cxf.ws.security.wss4j.WSS4JUtils.getReplayCache(WSS4JUtils.java:103)
        at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getReplayCache(WSS4JInInterceptor.java:822)
        at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.configureReplayCaches(WSS4JInInterceptor.java:429)
        at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:252)
        at
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:121)
        at
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:106)




On Mon, May 26, 2014 at 12:52 PM, Jason Pell <ja...@pellcorp.com> wrote:

> Hi,
>
> I already create a eh cache manager for caching spring security ldap user
> details.  I would like to force CXF to use the very same eh cache manager
> rather than create a new one.
>
> I have the following spring bean:
>
> org.springframework.cache.ehcache.EhCacheManagerFactoryBean
>
> <bean id="ehCacheManager"
>
> class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
>         <property name="configLocation"
> value="file:${spring.config.dir}/ehcache.xml" />
>         <property name="shared" value="true" />
>     </bean>
>
> So I would like to put all of the configuration for ehcache into the
> ehcache.xml I use for hibernate and spring security.
>
> Any suggestions as to how I might do this?
>
>
>