Thanks to Rajith.

I hope we don't have the 15 mins limitation, and would like to make sure the 
cache will not refer to the old tenant after removal.


Where can I find the background job per 15 mins interval you mentioned?


Regards, Wenxing


------------------ Original ------------------
From:  "Rajith Roshan";<[email protected]>;
Send time: Tuesday, Nov 8, 2016 3:29 PM
To: "wenxzhen"<[email protected]>; 
Cc: "dev"<[email protected]>; 
Subject:  Re: [Dev] How to clear up the Registry Cache?



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 <[email protected]> wrote:
Dear experts,


Please advice a way to clear up the Registry Cache, which is really good to 
have.


Thanks, Wenxing




------------------ Original ------------------
From:  "wenxzhen";<[email protected]>;
Date:  Nov 7, 2016
To:  "wenxzhen"<[email protected]>; "Rajith Roshan"<[email protected]>; 
Cc:  "dev"<[email protected]>; 
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";<[email protected]>;
Date:  Nov 7, 2016
To:  "Rajith Roshan"<[email protected]>; 
Cc:  "dev"<[email protected]>; 
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";<[email protected]>;
Send time: Monday, Nov 7, 2016 2:22 PM
To: "wenxzhen"<[email protected]>; 
Cc: "KasunG Gajasinghe"<[email protected]>; "dev"<[email protected]>; 
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 <[email protected]> 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";<[email protected]>;
Send time: Monday, Nov 7, 2016 1:43 PM
To: "wenxzhen"<[email protected]>; 
Cc: "dev"<[email protected]>; 
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 <[email protected]> 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(CarbonCacheManager.java:111)
        at 
org.wso2.carbon.registry.core.utils.RegistryUtils.getResourceCache(RegistryUtils.java:297)
        at 
org.wso2.carbon.registry.core.caching.CacheBackedRegistry.getCache(CacheBackedRegistry.java:62)
        at 
org.wso2.carbon.registry.core.caching.CacheBackedRegistry.resourceExists(CacheBackedRegistry.java:289)
        at 
org.wso2.carbon.registry.core.session.UserRegistry.resourceExistsInternal(UserRegistry.java:770)
        at 
org.wso2.carbon.registry.core.session.UserRegistry.access$800(UserRegistry.java:60)
        at 
org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:753)
        at 
org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:750)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(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
 [email protected]
 http://wso2.org/cgi-bin/mailman/listinfo/dev
 





-- 
Rajith Roshan

Software Engineer, WSO2 Inc.
 Mobile: +94-72-642-8350



 






_______________________________________________
 Dev mailing list
 [email protected]
 http://wso2.org/cgi-bin/mailman/listinfo/dev
 





-- 
Rajith Roshan

Software Engineer, WSO2 Inc.
 Mobile: +94-72-642-8350
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to