Seems the tenant domain resolving should happen in CarbonContext. The
CacheManagerFactory simply do a
CarbonContext.getThreadLocalCarbonContext().getTenantDomain();


On Sun, Aug 4, 2013 at 11:31 PM, Kasun Gajasinghe <[email protected]> wrote:

> Hi,
>
> If tenant domain is not set, we can derive it via tenant id, right? But
> the method getCacheManager in CacheManagerFactoryImpl [1] do not do this,
> and therefore fails with a NPE. Following error was observed when a
> datasource addition triggered a cluster notification, and the worker node
> tried to process it. Only the tenant id is set in the cluster message.
>
> [1] org.wso2.carbon.caching.impl.CacheManagerFactoryImpl#getCacheManager
>
>
> [2013-08-04 23:15:36,947] ERROR
> {org.wso2.carbon.core.clustering.hazelcast.HazelcastClusterMessageListener}
> -  Cannot process ClusteringMessage
> org.apache.axis2.clustering.ClusteringFault: Error in handling data source
> stat message: Error in updating data source 'test' from registry
> [remove:false]: Tenant domain has not been set in CarbonContext
>  at
> org.wso2.carbon.ndatasource.core.DataSourceStatMessage.execute(DataSourceStatMessage.java:74)
> at
> org.wso2.carbon.core.clustering.hazelcast.HazelcastClusterMessageListener.onMessage(HazelcastClusterMessageListener.java:54)
>  at
> com.hazelcast.impl.ListenerManager.callListener(ListenerManager.java:419)
> at
> com.hazelcast.impl.ListenerManager.callListeners(ListenerManager.java:334)
>  at com.hazelcast.impl.BaseManager$2.run(BaseManager.java:1392)
> at
> com.hazelcast.impl.executor.ParallelExecutorService$ParallelExecutorImpl$ExecutionSegment.run(ParallelExecutorService.java:212)
>  at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>  at java.lang.Thread.run(Thread.java:662)
> at
> com.hazelcast.impl.ExecutorThreadFactory$1.run(ExecutorThreadFactory.java:45)
> Caused by: org.wso2.carbon.ndatasource.common.DataSourceException: Error
> in updating data source 'test' from registry [remove:false]: Tenant domain
> has not been set in CarbonContext
> at
> org.wso2.carbon.ndatasource.core.DataSourceRepository.updateDataSource(DataSourceRepository.java:186)
>  at
> org.wso2.carbon.ndatasource.core.DataSourceRepository.refreshUserDataSource(DataSourceRepository.java:157)
> at
> org.wso2.carbon.ndatasource.core.DataSourceStatMessage.execute(DataSourceStatMessage.java:71)
>  ... 9 more
> *Caused by: java.lang.NullPointerException: Tenant domain has not been
> set in CarbonContext*
> * at
> org.wso2.carbon.caching.impl.CacheManagerFactoryImpl.getCacheManager(CacheManagerFactoryImpl.java:79)
> *
>  at
> org.wso2.carbon.registry.core.utils.RegistryUtils.getCacheManager(RegistryUtils.java:289)
> at
> org.wso2.carbon.registry.core.utils.RegistryUtils.getResourceCache(RegistryUtils.java:272)
>  at
> org.wso2.carbon.registry.core.caching.CacheBackedRegistry.getCache(CacheBackedRegistry.java:62)
> at
> org.wso2.carbon.registry.core.caching.CacheBackedRegistry.resourceExists(CacheBackedRegistry.java:246)
>  at
> org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:629)
> at
> org.wso2.carbon.ndatasource.core.DataSourceRepository.getDataSourceMetaInfoFromRegistryPath(DataSourceRepository.java:409)
>  at
> org.wso2.carbon.ndatasource.core.DataSourceRepository.updateDataSource(DataSourceRepository.java:164)
> ... 11 more
>
>
> --
> *Kasun Gajasinghe*
> Software Engineer;
> Development Technologies Team, WSO2 Inc.; http://wso2.com
>
>
>  ,
> *email: **kasung AT spamfree wso2.com
>
>
> ** cell: **+94 (77) 678-0813*
> *linked-in: *http://lk.linkedin.com/in/gajasinghe
>
>
> *
> *
> *blog: **http://kasunbg.org* <http://kasunbg.org>
>
>
> *
> twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>
>
>
> *
> *
>



-- 
*Kasun Gajasinghe*
Software Engineer;
Development Technologies Team, WSO2 Inc.; http://wso2.com


 ,
*email: **kasung AT spamfree wso2.com


** cell: **+94 (77) 678-0813*
*linked-in: *http://lk.linkedin.com/in/gajasinghe


*
*
*blog: **http://kasunbg.org* <http://kasunbg.org>


*
twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>


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

Reply via email to