stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Isuru Haththotuwa <isu...@apache.org>
Subject Re: Updated Task List
Date Fri, 19 Sep 2014 04:54:19 GMT
Hi Martin,

It seems the relevant tenant information is not set properly in the thread
local carbon context. This is happening since Topology events, such as the
Application Created event, are received in a separate thread, and the
tenant information is not set in that particular thread. To overcome this,
we need to start a tenant flow, with the relevant tenant information, prior
to creating the ApplicationSubscription and persisting it. I have shown a
sample below [1].

Please let me know if this works for you.

[1].     try {
                PrivilegedCarbonContext.startTenantFlow();
                PrivilegedCarbonContext carbonContext =
PrivilegedCarbonContext.getThreadLocalCarbonContext();
                carbonContext.setTenantDomain(<relevant_tenant_domain>);
                carbonContext.setTenantId(<relevant_tenant_id>);

               // call create Application Subscription and persist

            } finally {
                PrivilegedCarbonContext.endTenantFlow();
            }


On Fri, Sep 19, 2014 at 12:42 AM, Martin Eppel (meppel) <meppel@cisco.com>
wrote:

>  Hi Isuru,
>
>
>
> I verified the fix for the jira [1].
> https://issues.apache.org/jira/browse/STRATOS-805 and it works, the event
> gets delivered.
>
>
>
> However I do face another issue, see exception below, I opened a JIRA for
> it: https://issues.apache.org/jira/browse/STRATOS-806
>
>
>
> Thanks
>
>
>
> Martin
>
>
>
>
>
> TID: [0] [STRATOS] [2014-09-18 18:50:53,313] DEBUG
> {org.apache.stratos.manager.manager.CartridgeSubscriptionManager} -
> createCompositeAppSubscription for appId: test_app3 and tenantId: -1234
> {org.apache.stratos.manager.manager.CartridgeSubscriptionManager}
>
> TID: [0] [STRATOS] [2014-09-18 18:50:53,320] ERROR
> {org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageDelegator}
> -  Failed to retrieve topology event message
> {org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageDelegator}
>
> 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:288)
>
>         at
> org.wso2.carbon.registry.core.utils.RegistryUtils.getResourceCache(RegistryUtils.java:271)
>
>         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.apache.stratos.manager.registry.RegistryManager.initRegistry(RegistryManager.java:83)
>
>         at
> org.apache.stratos.manager.registry.RegistryManager.retrieve(RegistryManager.java:185)
>
>         at
> org.apache.stratos.manager.persistence.RegistryBasedPersistenceManager.getSubscription(RegistryBasedPersistenceManager.java:438)
>
>         at
> org.apache.stratos.manager.persistence.RegistryBasedPersistenceManager.getCompositeAppSubscription(RegistryBasedPersistenceManager.java:429)
>
>         at
> org.apache.stratos.manager.retriever.DataInsertionAndRetrievalManager.getCompositeAppSubscription(DataInsertionAndRetrievalManager.java:405)
>
>         at
> org.apache.stratos.manager.manager.CartridgeSubscriptionManager.createCompositeAppSubscription(CartridgeSubscriptionManager.java:102)
>
>         at
> org.apache.stratos.manager.topology.receiver.StratosManagerTopologyEventReceiver$9.onEvent(StratosManagerTopologyEventReceiver.java:303)
>
>         at
> org.apache.stratos.messaging.listener.EventListener.update(EventListener.java:42)
>
>         at java.util.Observable.notifyObservers(Observable.java:159)
>
>         at
> org.apache.stratos.messaging.event.EventObservable.notifyEventListeners(EventObservable.java:51)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ApplicationCreatedMessageProcessor.process(ApplicationCreatedMessageProcessor.java:77)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.GroupActivatedProcessor.process(GroupActivatedProcessor.java:37)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.MemberTerminatedMessageProcessor.process(MemberTerminatedMessageProcessor.java:133)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.MemberSuspendedMessageProcessor.process(MemberSuspendedMessageProcessor.java:143)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.MemberMaintenanceModeProcessor.process(MemberMaintenanceModeProcessor.java:142)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.MemberReadyToShutdownMessageProcessor.process(MemberReadyToShutdownMessageProcessor.java:141)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.MemberActivatedMessageProcessor.process(MemberActivatedMessageProcessor.java:158)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.MemberStartedMessageProcessor.process(MemberStartedMessageProcessor.java:144)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.InstanceSpawnedMessageProcessor.process(InstanceSpawnedMessageProcessor.java:135)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ClusterRemovedMessageProcessor.process(ClusterRemovedMessageProcessor.java:108)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ClusterMaintenanceModeMessageProcessor.process(ClusterMaintenanceModeMessageProcessor.java:109)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ClusterActivatedProcessor.process(ClusterActivatedProcessor.java:37)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ClusterCreatedMessageProcessor.process(ClusterCreatedMessageProcessor.java:117)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ServiceRemovedMessageProcessor.process(ServiceRemovedMessageProcessor.java:87)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.ServiceCreatedMessageProcessor.process(ServiceCreatedMessageProcessor.java:87)
>
>         at
> org.apache.stratos.messaging.message.processor.topology.CompleteTopologyMessageProcessor.process(CompleteTopologyMessageProcessor.java:151)
>
>         at
> org.apache.stratos.messaging.message.processor.MessageProcessorChain.process(MessageProcessorChain.java:60)
>
>         at
> org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageDelegator.run(TopologyEventMessageDelegator.java:77)
>
>         at java.lang.Thread.run(Thread.java:745)
>
>
>

Mime
View raw message