Hi ,

You don't need to explicitly clear the registry cache. The cache will
automatically invalidate within 15 minutes. Or the cache will be cleared
when server is re started.
The issue you are facing is trying to access the cache using newly crated
tenant which causing a security issue. Seems like the owner of cache
instance still the old tenant.

Thanks!
Rajith

On Tue, Nov 8, 2016 at 8:48 AM, wenxzhen <wenxing.zh...@qq.com> wrote:

> Dear experts,
>
> Please advice a way to clear up the Registry Cache, which is really good
> to have.
>
> Thanks, Wenxing
>
>
> ------------------ Original ------------------
> *From: * "wenxzhen";<wenxing.zh...@qq.com>;
> *Date: * Nov 7, 2016
> *To: * "wenxzhen"<wenxing.zh...@qq.com>; "Rajith Roshan"<raji...@wso2.com>;
>
> *Cc: * "dev"<dev@wso2.org>;
> *Subject: * Re: [Dev] How to clear up the Registry Cache?
>
> Appreciated if anyone can shed some light on how to clear up the Registry
> Cache.
>
> Thanks, Wenxing
>
> ------------------ Original ------------------
> *From: * "wenxzhen";<wenxing.zh...@qq.com>;
> *Date: * Nov 7, 2016
> *To: * "Rajith Roshan"<raji...@wso2.com>;
> *Cc: * "dev"<dev@wso2.org>;
> *Subject: * Re: [Dev] How to clear up the Registry Cache?
>
> Hi Rajith,
>
> You are right, there is no well defined way. Before deleting the UM data
> and Registry data, I have already deactivated the tenant.
>
> The exception below happened on my re-creation of the tenant with the same
> name. Please advice whether it's the problem that the Registry cache was
> not cleared up?
>
> Thanks, Wenxing
>
>
> ------------------ Original ------------------
> *From: * "Rajith Roshan";<raji...@wso2.com>;
> *Send time:* Monday, Nov 7, 2016 2:22 PM
> *To:* "wenxzhen"<wenxing.zh...@qq.com>;
> *Cc:* "KasunG Gajasinghe"<kas...@wso2.com>; "dev"<dev@wso2.org>;
> *Subject: * Re: [Dev] How to clear up the Registry Cache?
>
> Hi,
>
> ASFAIK there is no well defined way to delete a tenant. You can deactivate
> a tenant. If you are using custom code then this error may be due to
> starting a wrong tenant flow in your code.
>
> Thanks!
> Rajith
>
> On Mon, Nov 7, 2016 at 10:46 AM, wenxzhen <wenxing.zh...@qq.com> wrote:
>
>> Thanks to Lakshani and Kasun.
>>
>> Regarding the TenantMgtListener extension, any reference or example to do
>> the cache clearing since our application is a WEB application?
>>
>> Thanks again, Wenxing
>>
>>
>> ------------------ Original ------------------
>> *From: * "KasunG Gajasinghe";<kas...@wso2.com>;
>> *Send time:* Monday, Nov 7, 2016 1:43 PM
>> *To:* "wenxzhen"<wenxing.zh...@qq.com>;
>> *Cc:* "dev"<dev@wso2.org>;
>> *Subject: * Re: [Dev] How to clear up the Registry Cache?
>>
>>
>> This sounds like a bug. When a tenant is deleted, the cache should be
>> cleared automatically. You shouldn't have to wait for the periodic cache
>> cleanup.
>>
>> My suggestion is to write a TenantMgtListener extension, and add it to
>> the product. In there, you can add a cache clearing operation for the
>> tenant pre/post delete method.
>>
>> On Monday, November 7, 2016, wenxzhen <wenxing.zh...@qq.com> wrote:
>>
>>> Dear all,
>>>
>>> I am trying to remove a Tenant from the WSO2, but I found the following
>>> exception after removing a Tenant and then re-create it:
>>>
>>> Caused by: java.lang.SecurityException: Illegal access attempt to cache
>>> ] owned by tenant {[testdomain7],[17]} by tenant {[testdomain7],[18]}
>>>         at org.wso2.carbon.caching.impl.Util.checkAccess(Util.java:46)
>>>         at org.wso2.carbon.caching.impl.CarbonCacheManager.getCache(Car
>>> bonCacheManager.java:111)
>>>         at org.wso2.carbon.registry.core.utils.RegistryUtils.getResourc
>>> eCache(RegistryUtils.java:297)
>>>         at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.ge
>>> tCache(CacheBackedRegistry.java:62)
>>>         at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.re
>>> sourceExists(CacheBackedRegistry.java:289)
>>>         at org.wso2.carbon.registry.core.session.UserRegistry.resourceE
>>> xistsInternal(UserRegistry.java:770)
>>>         at org.wso2.carbon.registry.core.session.UserRegistry.access$80
>>> 0(UserRegistry.java:60)
>>>         at org.wso2.carbon.registry.core.session.UserRegistry$9.run(Use
>>> rRegistry.java:753)
>>>         at org.wso2.carbon.registry.core.session.UserRegistry$9.run(Use
>>> rRegistry.java:750)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at org.wso2.carbon.registry.core.session.UserRegistry.resourceE
>>> xists(UserRegistry.java:750)
>>>         ... 62 more
>>>
>>> My question is how I can remove the related Registry cache of a tenant?
>>> Thank you very much.
>>>
>>> Regards, Wenxing
>>>
>>>
>>
>> --
>>
>> *Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc.
>> email: kasung AT spamfree wso2.com
>> linked-in: http://lk.linkedin.com/in/gajasinghe
>> blog: http://kasunbg.org
>> phone: +1 650-745-4499, 77 678 0813
>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Rajith Roshan
> Software Engineer, WSO2 Inc.
> Mobile: +94-72-642-8350
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-72-642-8350 <%2B94-71-554-8430>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to